run_python.sh 531 B

1234567891011121314
  1. # This script can be used for launching a Python script from the Android
  2. # terminal environment, for example from within termux. It uses a socket
  3. # to pipe the command-line output back to the terminal.
  4. port=12345
  5. if [[ $# -eq 0 ]] ; then
  6. echo "Pass full path of script"
  7. exit 1
  8. fi
  9. am start --activity-clear-task -n org.panda3d.sdk/org.panda3d.android.PythonActivity --user 0 --es org.panda3d.OUTPUT_URI tcp://127.0.0.1:$port --grant-read-uri-permission --grant-write-uri-permission file://$(realpath $1)
  10. nc -l -p $port