I have been experimenting lately with some python scripts using the concept of http://code.google.com/p/android-scripting/
however i found the interface limiting in lots of places.
so i have worked on this and found an optimal solution so here is the customized script.
These changes allow for following things.
However we cann't undermine the SL4A project coz the project is there to provide interfacing between android and python.
successfully
I will try to keep updating all the python scripts that i have been able to run hope others can also contribute to it.
however i found the interface limiting in lots of places.
- you can't run applications on console directly.
- you have environmental limitations.
- you can't pass command-line arguments.
so i have worked on this and found an optimal solution so here is the customized script.
Code:
[B]PW=`pwd`[/B]
export EXTERNAL_STORAGE=/mnt/sdcard
[B]export LANG=en[/B]
PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python
PYTHONPATH=${PYTHONPATH}:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload
export PYTHONPATH
export TEMP=/mnt/storage/com.googlecode.pythonforandroid/extras/python/tmp
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/python
export LD_LIBRARY_PATH=/data/data/com.googlecode.pythonforandroid/files/python/lib
[B]cd $PW[/B]
/data/data/com.googlecode.pythonforandroid/files/python/bin/python "$@"
These changes allow for following things.
- allow us to use this shell script to call python.
- allows for command line argument passing.
- relative path references are now working
- script is named as py and placed at /system/bin/
- chmod 755 /system/bin/py
- so now i can naviagate to any folder and just type py followed by script name to execute it.
However we cann't undermine the SL4A project coz the project is there to provide interfacing between android and python.
successfully
I will try to keep updating all the python scripts that i have been able to run hope others can also contribute to it.