How to execute Python scripts in Android

First, you need to install QPython in your Android.
To access to your Android console, you can use SSHDroid (remote access) or Terminal Emulator (local access).

Python for Android depends from a lot bash scripts. You need use all of them to run it.
Now, you need add to your PATH (configurable in init.environ.rc), python executable.
Other option is create symbolic links of your apps to /system/bin, as follow:

su
mount -o rw,remount /system
cd /system/bin
ln -s /data/data/org.qpython.qpy/files/bin/end.sh 
ln -s /data/data/org.qpython.qpy/files/bin/python-android5
ln -s /data/data/org.qpython.qpy/files/bin/init.sh
ln -s /data/data/org.qpython.qpy/files/bin/qpython-android5.sh python

Now you can run python on your console :)
To execute a python script without calls to python, you must write on the first line of your script this line:

#!/system/bin/python

To execute the script, give it execution permission throught the console:

chmod +x $NAME.py

you can run the script throught your console as follow:








Comments

Popular posts from this blog

Exception: Could not find a default OpenFlow controller in Mininet

How to fix Android when developer options are not available for this user

Webcam streaming throught VLC with YUY2 compatibility