Comment on RunPythonFromShell in python-for-android

347 views
Skip to first unread message

python-fo...@googlecode.com

unread,
Jun 4, 2012, 7:57:44 PM6/4/12
to python-fo...@googlegroups.com
Comment by Darten.b...@gmail.com:

And why not compile that “Android-standard“ into the interpreter???

For more information:
http://code.google.com/p/python-for-android/wiki/RunPythonFromShell

python-fo...@googlecode.com

unread,
Jun 5, 2012, 12:35:07 PM6/5/12
to python-fo...@googlegroups.com
Comment by gene.res...@gmail.com:

In case it's of interest, I have used these environment settings
successfully to run Python from a Java subprocess started and connected to
standard streams with ProcessBuilder. Write me for code if you need it.

python-fo...@googlecode.com

unread,
Jun 27, 2012, 3:27:19 PM6/27/12
to python-fo...@googlegroups.com
Comment by cyril.ho...@gmail.com:

For some reason that won't work for me, e.g. /mnt/storage does not exist
(but /mnt/sdcard is OK), /bin/sh won't work, ...

I run on a rooted device with some recompiled kernel, and busybox installed
in case it matters. I use the following script:
{{{
~ # cat /system/bin/py
#! /system/bin/sh
PW=`pwd`
export EXTERNAL_STORAGE=/mnt/sdcard
export LANG=en
export
PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6
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=$LD_LIBRARY_PATH:/data/data/com.googlecode.pythonforandroid/files/python/lib:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload:/mnt/sdcard/com.googlecode.pythonforandroid/extras/python
cd $PW
/data/data/com.googlecode.pythonforandroid/files/python/bin/python "$@"

python-fo...@googlecode.com

unread,
Sep 6, 2012, 12:00:30 AM9/6/12
to python-fo...@googlegroups.com
Comment by cryogeni...@gmail.com:

it does work, however I get an error when running scripts with android.py
module. I tried to connect terminal through dropbear but another error came
up. Someting about JASON not being able to decode something. Any solutions?
Btw python and everything was intalled on sdcard

python-fo...@googlecode.com

unread,
Sep 6, 2012, 12:05:24 AM9/6/12
to python-fo...@googlegroups.com
Comment by cryogeni...@gmail.com:

Python does work, however I get an error when running scripts with

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:34:11 AM1/4/13
to python-fo...@googlegroups.com
Comment by fihtest...@gmail.com:

for Comment by cyril.ho...@gmail.com, Jun 27, 2012
step 1:"#! /bin/sh" replace "#! /system/bin/sh"
step 2::"storage: replace "sdcard"
step 3:save named python
(cmd:./adb root)
./adb push python /system/bin
./adb shell
root@android:/ #python
################################################
dlopen libpython2.6.so
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)
[GCC 4.4.3] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.

#########################################
python does work, but i also get an error:
dlopen libpython2.6.so
what happen??

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:37:02 AM1/4/13
to python-fo...@googlegroups.com
Comment by fihtest...@gmail.com:

for Comment by cyril.ho...@gmail.com, Jun 27, 2012.
step 1:"#! /bin/sh" replace "#! /system/bin/sh".
step 2::"storage: replace "sdcard".
step 3:save named python.
(cmd:./adb root).
./adb push python /system/bin.
./adb shell.

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:38:12 AM1/4/13
to python-fo...@googlegroups.com
Comment by fihtest...@gmail.com:

{{{
for Comment by cyril.ho...@gmail.com, Jun 27, 2012
step 1:"#! /bin/sh" replace "#! /system/bin/sh"
step 2::"storage: replace "sdcard"
step 3:save named python
(cmd:./adb root)
./adb push python /system/bin
./adb shell

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:41:12 AM1/4/13
to python-fo...@googlegroups.com
Comment by fihtest...@gmail.com:

for Comment by cyril.ho...@gmail.com, Jun 27, 2012\\
step 1:"#! /bin/sh" replace "#! /system/bin/sh"\\
step 2::"storage: replace "sdcard"\\
step 3:save named python\\
(cmd:./adb root)\\
./adb push python /system/bin\\
./adb shell\\
root@android:/ #python\\
################################################\\
dlopen libpython2.6.so\\
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)\\
[GCC 4.4.3] on linux-armv7l\\
Type "help", "copyright", "credits" or "license" for more information.\\
>>> \\
#########################################\\
python does work, but I also get an error:\\

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:42:14 AM1/4/13
to python-fo...@googlegroups.com

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:43:14 AM1/4/13
to python-fo...@googlegroups.com

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:44:14 AM1/4/13
to python-fo...@googlegroups.com
Comment by fihtest...@gmail.com:

for Comment by cyril.ho...@gmail.com, Jun 27, 2012 \\ step 1:"#! /bin/sh"
replace "#! /system/bin/sh"\\
step 2::"storage: replace "sdcard"\\
step 3:save named python\\
(cmd:./adb root)\\
./adb push python /system/bin\\
./adb shell\\
root@android:/ #python\\ ########################################\\

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:46:58 AM1/4/13
to python-fo...@googlegroups.com
Comment by fihtest...@gmail.com:

<html>
for Comment by cyril.ho...@gmail.com, Jun 27, 2012<br>
step 1:"#! /bin/sh" replace "#! /system/bin/sh"<br>
step 2::"storage: replace "sdcard"<br>
step 3:save named python<br>
(cmd:./adb root)<br>
./adb push python /system/bin<br>
./adb shell<br>
root@android:/ #python<br>
##########################################<br>
dlopen libpython2.6.so<br>
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)<br>
[GCC 4.4.3] on linux-armv7l<br>
Type "help", "copyright", "credits" or "license" for more information.
>>> <br>
##########################################<br>
python does work, but I also get an error:<br>
dlopen libpython2.6.so<br>
what happen??<br>
</html>

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:47:59 AM1/4/13
to python-fo...@googlegroups.com
Comment by fihtest...@gmail.com:

<wiki:comment>
for Comment by cyril.ho...@gmail.com, Jun 27, 2012<br>
step 1:"#! /bin/sh" replace "#! /system/bin/sh"<br>
step 2::"storage: replace "sdcard"<br>
step 3:save named python<br>
(cmd:./adb root)<br>
./adb push python /system/bin<br>
./adb shell<br>
root@android:/ #python<br>
##########################################<br>
dlopen libpython2.6.so<br>
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)<br>
[GCC 4.4.3] on linux-armv7l<br>
Type "help", "copyright", "credits" or "license" for more information.
>>> <br>
##########################################<br>
python does work, but I also get an error:<br>
dlopen libpython2.6.so<br>
what happen??<br>
</wiki:comment>

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:49:29 AM1/4/13
to python-fo...@googlegroups.com

python-fo...@googlecode.com

unread,
Jan 4, 2013, 1:50:29 AM1/4/13
to python-fo...@googlegroups.com
Comment by fihtest...@gmail.com:

for Comment by cyril.ho...@gmail.com, Jun 27, 2012

step 1:"#! /bin/sh" replace "#! /system/bin/sh"

step 2::"storage: replace "sdcard"

step 3:save named python

(cmd:./adb root)

./adb push python /system/bin

./adb shell

root@android:/ #python

##########################################

dlopen libpython2.6.so

Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)

[GCC 4.4.3] on linux-armv7l

Type "help", "copyright", "credits" or "license" for more information.



##########################################

python does work, but I also get an error:

dlopen libpython2.6.so

what happen??

python-fo...@googlecode.com

unread,
Jan 5, 2013, 6:02:14 PM1/5/13
to python-fo...@googlegroups.com
Comment by ydir...@free.fr:

On a (typical ?) setup where /mnt/sdcard is a VFAT partition, not only the
/mnt/storage path has to be adjusted (in 2 places - sigh), the mount
permissions are so that $TEMP is not writable by everyone, and eg. help()
fails because of that.

Possible solution (but will be problematic if scripts don't cleanup their
tempfiles):
{{{
# mkdir /data/tmp
# mount -t tmpfs tmpfs /data/tmp
# chmod 1777 /data/tmp
}}}

and then in the script:
{{{
export TEMP=/data/tmp
}}}

But as such this is a hack: requires root acces, and the mount an chmod
have to be redone after each reboot. Not sure we even if we want to tell
android to do that on each boot (or how to do that in a clean way).

python-fo...@googlecode.com

unread,
Apr 24, 2013, 4:47:24 AM4/24/13
to python-fo...@googlegroups.com
Comment by meilland...@gmail.com:

i change for python3
{{{
#! /bin/sh

export EXTERNAL_STORAGE=/mnt/sdcard
PYTHONPATH=/mnt/sdcard/com.googlecode.python3forandroid/extras/python3
PYTHONPATH=${PYTHONPATH}:/data/data/com.googlecode.python3forandroid/files/python3/lib/python3.2/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.python3forandroid/files/python3
export
LD_LIBRARY_PATH=/data/data/com.googlecode.python3forandroid/files/python3/lib
/data/data/com.googlecode.python3forandroid/files/python3/bin/python3 "$@"
}}}

For more information:
https://code.google.com/p/python-for-android/wiki/RunPythonFromShell

python-fo...@googlecode.com

unread,
Apr 24, 2013, 10:45:10 AM4/24/13
to python-fo...@googlegroups.com

python-fo...@googlecode.com

unread,
Aug 6, 2013, 10:31:29 AM8/6/13
to python-fo...@googlegroups.com
Comment by jacobw...@gmail.com:

I'm running into the same problems. I've tried variations of all the
scripts above, but each time I get
'import site' failed; use -v for traceback
Python runs after that, but I can't use the android package whenever I run
python from the shell.
Any clue as to what's going on? I'm using a rooted nexus 7 (2013) with
busybox installed.

python-fo...@googlecode.com

unread,
Aug 6, 2013, 10:40:02 AM8/6/13
to python-fo...@googlegroups.com
Comment by anthony....@gmail.com:

'import site' failed means either your $PYTHONPATH is not set properly or
the location pointed by your $PYTHONPATH does not contain the Python extras
stuff (site.py etc...)

python-fo...@googlecode.com

unread,
Oct 21, 2013, 10:24:16 AM10/21/13
to python-fo...@googlegroups.com
Comment by wardriv...@gmail.com:

I'm just new one for this and just try to start learning python
programming! I'm just testing that script on my momo9 tablet ..... It's
work for me! I only remove the first line that started with shebang '#!'.

PW=`pwd`
export EXTERNAL_STORAGE=/mnt/sdcard
export LANG=en
export
PYTHONPATH=/mnt/sdcard/com.googlecode.pythonforandroid/extras/python:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6
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=$LD_LIBRARY_PATH:/data/data/com.googlecode.pythonforandroid/files/python/lib:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload:/mnt/sdcard/com.googlecode.pythonforandroid/extras/python
cd $PW
/data/data/com.googlecode.pythonforandroid/files/python/bin/python "$@"

It's work!

python-fo...@googlecode.com

unread,
Oct 21, 2013, 10:27:05 AM10/21/13
to python-fo...@googlegroups.com
Comment by wardriv...@gmail.com:

I'm just new one for this and just try to start learning python
programming! I'm just testing that script on my momo9 tablet ..... It's
work for me! I only remove the first line that started with shebang '#!'.


python-fo...@googlecode.com

unread,
Oct 21, 2013, 10:31:19 AM10/21/13
to python-fo...@googlegroups.com
Comment by wardriv...@gmail.com:

I'm just new one for this and try to start learning python programming! I'm
just testing that script on my momo9 tablet 4.0.4 ..... It's work for me! I

python-fo...@googlecode.com

unread,
May 18, 2014, 6:31:39 PM5/18/14
to python-fo...@googlegroups.com
Comment by I.J.Se...@gmail.com:

Is there a way to run PYTHONSTARTUP?

python-fo...@googlecode.com

unread,
May 25, 2014, 10:19:54 AM5/25/14
to python-fo...@googlegroups.com
Comment by sengka...@gmail.com:

I have successfully to running python on terminal emulator, and I can
importing modules with normally, but I installing python of version the
python 2.6.2..

This is result for execute of python code on terminal emulator..

+-------------------------+
.../local/bin:$PATH
u0_a115@android:/ $ su
root@android:/ # python2
Python 2.6.2 (default, Apr 19 2012, 12:16:58)
[GCC 4.4.3] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>> import sl4a
>>> dir(sl4a)
['Android', 'HANDSHAKE', 'HOST', 'PORT', 'Result', '__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__name__', '__package__', 'collections', 'json', 'os', 'socket', 'sys']
>>> import pygame
>>> dir(pygame)
['ACTIVEEVENT', 'ANYFORMAT', 'ASYNCBLIT', 'AUDIO_S16', 'AUDIO_S16LSB', 'AUDIO_S16MSB', 'AUDIO_S16SYS', 'AUDIO_S8', 'AUDIO_U16', 'AUDIO_U16LSB', 'AUDIO_U16MSB', 'AUDIO_U16SYS', 'AUDIO_U8', 'BIG_ENDIAN', 'BLEND_ADD', 'BLEND_MAX', 'BLEND_MIN', 'BLEND_MULT', 'BLEND_RGBA_ADD', 'BLEND_RGBA_MAX', 'BLEND_RGBA_MIN', 'BLEND_RGBA_MULT', 'BLEND_RGBA_SUB', 'BLEND_RGB_ADD', 'BLEND_RGB_MAX', 'BLEND_RGB_MIN', 'BLEND_RGB_MULT', 'BLEND_RGB_SUB', 'BLEND_SUB', 'BUTTON_X1', 'BUTTON_X2', 'Color', 'DOUBLEBUF', 'FULLSCREEN', 'GL_ACCELERATED_VISUAL', 'GL_ACCUM_ALPHA_SIZE', 'GL_ACCUM_BLUE_SIZE', 'GL_ACCUM_GREEN_SIZE', 'GL_ACCUM_RED_SIZE', 'GL_ALPHA_SIZE', 'GL_BLUE_SIZE', 'GL_BUFFER_SIZE', 'GL_DEPTH_SIZE', 'GL_DOUBLEBUFFER', 'GL_GREEN_SIZE', 'GL_MULTISAMPLEBUFFERS', 'GL_MULTISAMPLESAMPLES', 'GL_RED_SIZE', 'GL_STENCIL_SIZE', 'GL_STEREO', 'GL_SWAP_CONTROL', 'HAT_CENTERED', 'HAT_DOWN', 'HAT_LEFT', 'HAT_LEFTDOWN', 'HAT_LEFTUP', 'HAT_RIGHT', 'HAT_RIGHTDOWN', 'HAT_RIGHTUP', 'HAT_UP', 'HWACCEL', 'HWPALETTE', 'HWSURFACE', 'IYUV_OVERLAY', 'JOYAXISMOTION', 'JOYBALLMOTION', 'JOYBUTTONDOWN', 'JOYBUTTONUP', 'JOYHATMOTION', 'KEYDOWN', 'KEYUP', 'KMOD_ALT', 'KMOD_CAPS', 'KMOD_CTRL', 'KMOD_LALT', 'KMOD_LCTRL', 'KMOD_LMETA', 'KMOD_LSHIFT', 'KMOD_META', 'KMOD_MODE', 'KMOD_NONE', 'KMOD_NUM', 'KMOD_RALT', 'KMOD_RCTRL', 'KMOD_RMETA', 'KMOD_RSHIFT', 'KMOD_SHIFT', 'K_0', 'K_1', 'K_2', 'K_3', 'K_4', 'K_5', 'K_6', 'K_7', 'K_8', 'K_9', 'K_AMPERSAND', 'K_ASTERISK', 'K_AT', 'K_BACKQUOTE', 'K_BACKSLASH', 'K_BACKSPACE', 'K_BREAK', 'K_CAPSLOCK', 'K_CARET', 'K_CLEAR', 'K_COLON', 'K_COMMA', 'K_DELETE', 'K_DOLLAR', 'K_DOWN', 'K_END', 'K_EQUALS', 'K_ESCAPE', 'K_EURO', 'K_EXCLAIM', 'K_F1', 'K_F10', 'K_F11', 'K_F12', 'K_F13', 'K_F14', 'K_F15', 'K_F2', 'K_F3', 'K_F4', 'K_F5', 'K_F6', 'K_F7', 'K_F8', 'K_F9', 'K_FIRST', 'K_GREATER', 'K_HASH', 'K_HELP', 'K_HOME', 'K_INSERT', 'K_KP0', 'K_KP1', 'K_KP2', 'K_KP3', 'K_KP4', 'K_KP5', 'K_KP6', 'K_KP7', 'K_KP8', 'K_KP9', 'K_KP_DIVIDE', 'K_KP_ENTER', 'K_KP_EQUALS', 'K_KP_MINUS', 'K_KP_MULTIPLY', 'K_KP_PERIOD', 'K_KP_PLUS', 'K_LALT', 'K_LAST', 'K_LCTRL', 'K_LEFT', 'K_LEFTBRACKET', 'K_LEFTPAREN', 'K_LESS', 'K_LMETA', 'K_LSHIFT', 'K_LSUPER', 'K_MENU', 'K_MINUS', 'K_MODE', 'K_NUMLOCK', 'K_PAGEDOWN', 'K_PAGEUP', 'K_PAUSE', 'K_PERIOD', 'K_PLUS', 'K_POWER', 'K_PRINT', 'K_QUESTION', 'K_QUOTE', 'K_QUOTEDBL', 'K_RALT', 'K_RCTRL', 'K_RETURN', 'K_RIGHT', 'K_RIGHTBRACKET', 'K_RIGHTPAREN', 'K_RMETA', 'K_RSHIFT', 'K_RSUPER', 'K_SCROLLOCK', 'K_SEMICOLON', 'K_SLASH', 'K_SPACE', 'K_SYSREQ', 'K_TAB', 'K_UNDERSCORE', 'K_UNKNOWN', 'K_UP', 'K_a', 'K_b', 'K_c', 'K_d', 'K_e', 'K_f', 'K_g', 'K_h', 'K_i', 'K_j', 'K_k', 'K_l', 'K_m', 'K_n', 'K_o', 'K_p', 'K_q', 'K_r', 'K_s', 'K_t', 'K_u', 'K_v', 'K_w', 'K_x', 'K_y', 'K_z', 'LIL_ENDIAN', 'MOUSEBUTTONDOWN', 'MOUSEBUTTONUP', 'MOUSEMOTION', 'Mask', 'NOEVENT', 'NOFRAME', 'NUMEVENTS', 'OPENGL', 'OPENGLBLIT', 'Overlay', 'PREALLOC', 'PixelArray', 'QUIT', 'RESIZABLE', 'RLEACCEL', 'RLEACCELOK', 'Rect', 'SCRAP_BMP', 'SCRAP_CLIPBOARD', 'SCRAP_PBM', 'SCRAP_PPM', 'SCRAP_SELECTION', 'SCRAP_TEXT', 'SRCALPHA', 'SRCCOLORKEY', 'SWSURFACE', 'SYSWMEVENT', 'Surface', 'SurfaceType', 'TIMER_RESOLUTION', 'USEREVENT', 'UYVY_OVERLAY', 'VIDEOEXPOSE', 'VIDEORESIZE', 'YUY2_OVERLAY', 'YV12_OVERLAY', 'YVYU_OVERLAY', '__builtins__', '__color_constructor', '__color_reduce', '__doc__', '__file__', '__name__', '__package__', '__path__', '__rect_constructor', '__rect_reduce', '__version__', 'base', 'bufferproxy', 'cdrom', 'color', 'colordict', 'compat', 'constants', 'cursors', 'display', 'draw', 'error', 'event', 'fastevent', 'font', 'get_error', 'get_sdl_byteorder', 'get_sdl_version', 'image', 'init', 'joystick', 'key', 'mask', 'mixer', 'mouse', 'movie', 'overlay', 'packager_imports', 'pixelarray', 'quit', 'rect', 'register_quit', 'scrap', 'segfault', 'set_error', 'sndarray', 'sprite', 'string', 'surface', 'surfarray', 'sysfont', 'threads', 'time', 'transform', 'ver', 'vernum', 'version', 'warn_unwanted_files']


+-----------------------------+

And this code that I made:

If you want to try of my trick, how to:

* 1 - please create file named of "python2" without quote, and inserting
code:

#+-----------------------------+

#!/system/bin/sh
#by nass...@facebook.com

export TERM=xterm

export PATH=/sbin:/system/sbin:/system/bin:/system/xbin

export
LD_LIBRARY_PATH=/data/data/com.googlecode.pythonforandroid/files/python/lib

export PYTHONHOME=
/sdcard/com.googlecode.pythonforandroid/extras/python:/data/data/com.googlecode.pythonforandroid/files/python

export
PYTHONPATH=/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload:/sdcard/com.googlecode.pythonforandroid/extras/python

export
PYTHONSTARTUP=/sdcard/com.googlecode.pythonforandroid/extras/python/start.py

export AP_HOST=127.0.0.1
export AP_PORT=51321
export AP_HANDSHAKE=6af52893-356b-4ca3-b6c2-9dcc6bc15f03

cd /data/data/com.googlecode.pythonforandroid/files/python/bin &&
/data/data/com.googlecode.pythonforandroid/files/python/bin/python $@

# +-----------------------------+

* 2 - you can moving a file "python2" on folder "/system/bin/move in this",

* 3 - open terminal emulator and exec code "su" for accessing a root,

* 4 - next you can execute a command "python2".

See example on top..

python-fo...@googlecode.com

unread,
Feb 9, 2015, 2:55:06 PM2/9/15
to python-fo...@googlegroups.com
Comment by nax...@gmail.com:

I have install the apk, but when i try to launch the sh i get this
erroru0_a82@android:/ $ cd sdcard
u0_a82@android:/sdcard $ sh py.sh
py.sh[12]:
/data/data/com.googlecode.pythonforandroid/files/python/bin/python: not
found
127|u0_a82@android:/sdcard $ cd /data
u0_a82@android:/data $ cd dats
/system/bin/sh: cd: /data/dats: No such file or directory
googlecode.pyth <
/system/bin/sh: cd: /data/com.googlecode.pyth: No such file or directory
2|u0_a82@android:/data $ cd data
m.googlecode.py <
/system/bin/sh: cd: /data/data/com.googlecode.py: No such file or directory
2|u0_a82@android:/data/data $ ls
opendir failed, Permission denied
255|u0_a82@android:/data/data $ cd ..
u0_a82@android:/data $ cd ..
d sdcard/ <
u0_a82@android:/sdcard $ su
py.sh <
py.sh[12]:
/data/data/com.googlecode.pythonforandroid/files/python/bin/python: not
found
d /data <
root@android:/data # cd data
root@android:/data/data # cd com.
com.AndroidA.ffmpegCodec.armV7n/
com.MediaConverter.ffmpegCodec.armV7n/
com.NxIndustries.Zram/
com.andrewshu.android.reddit/
com.android.LGSetupWizard/
com.android.backupconfirm/
com.android.bluetooth/
com.android.browser/
com.android.calculator2/
com.android.calendar/
com.android.cellbroadcastreceiver/
com.android.certinstaller/
com.android.chrome/
com.android.contacts/
com.android.defcontainer/
com.android.gallery3d/
com.android.htmlviewer/
com.android.inputdevices/
com.android.keychain/
com.android.mms/
com.android.packageinstaller/
com.android.phone/
com.android.providers.applications/
com.android.providers.calendar/
com.android.providers.contacts/
com.android.providers.downloads.ui/
com.android.providers.downloads/
com.android.providers.drm/
com.android.providers.media/
com.android.providers.partnerbookmarks/ com.android.providers.settings/
com.android.providers.telephony/
com.android.providers.userdictionary/
com.android.settings/
com.android.sharedstoragebackup/
com.android.smspush/
com.android.stk/
com.android.systemui/
com.android.vending/
com.android.vpndialogs/
com.android.wallpaper.livepicker/
com.buak.Link2SD/
com.estrongs.android.pop/
com.estrongs.android.taskmanager/
com.farproc.wifi.analyzer/
com.forpda.lp/
com.georgie.SoundWire/
com.google.android.apps.docs/
com.google.android.apps.maps/
com.google.android.apps.plus/
com.google.android.apps.translate/
com.google.android.apps.uploader/
com.google.android.backup/
com.google.android.feedback/
com.google.android.gm/
com.google.android.gms/
com.google.android.googlequicksearchbox/
com.google.android.gsf.login/
com.google.android.gsf/
com.google.android.location/
com.google.android.partnersetup/
com.google.android.setupwizard/
com.google.android.street/
com.google.android.syncadapters.bookmarks/
com.google.android.syncadapters.calendar/
com.google.android.syncadapters.contacts/
com.google.android.tts/
com.google.android.voicesearch/
com.google.android.youtube/
com.googlecode.pythonforandroid/
com.hipipal.qpyplus/
com.hy.system.fontserver/
com.infraware.polarisviewer/
com.itunestoppodcastplayer.app/
com.lexa.fakegps/
com.lge.BtWifiTest/
com.lge.DeviceTest/
com.lge.QuickClip/
com.lge.allautotest/
com.lge.android.atservice/
com.lge.app.floating.res/
com.lge.app.richnote/
com.lge.appbox.bridge/
com.lge.appbox.client/
com.lge.appbox.remote/
com.lge.appwidget.lgsearch/
com.lge.camera/
com.lge.cameratest/
com.lge.clock/
com.lge.defaultaccount/
com.lge.dmf.admin/
com.lge.doubletap/
com.lge.drmservice/
com.lge.email/
com.lge.filemanager/
com.lge.fmradio/
com.lge.hiddenmenu/
com.lge.hiddenpersomenu/
com.lge.homeselector/
com.lge.ime/
com.lge.internal/
com.lge.launcher2.theme.cozywall/
com.lge.launcher2.theme.marshmallow/
com.lge.launcher2.theme.optimus/
com.lge.launcher2/
com.lge.lgdmsclient/
com.lge.lgdrm.permission/
com.lge.lgfota.permission/
com.lge.lginstallservies/
com.lge.lgworld/
com.lge.lockscreen/
com.lge.lockscreensettings/
com.lge.mlt/
com.lge.music/
com.lge.pcsyncui/
com.lge.permission/
com.lge.safetycare/
com.lge.shutdownmonitor/
com.lge.sizechangable.weather.theme.optimus/
com.lge.sizechangable.weather/
com.lge.smartcard.apdu/
com.lge.streamingplayer/
com.lge.sync/
com.lge.systemservice/
com.lge.task/
com.lge.videoplayer/
com.lge.voicerecorder/
com.lge.wapservice/
com.nema.batterycalibration/
com.qualcomm.privinit/
com.quoord.tapatalkpro.activity/
com.rsupport.rs.activity.lge/
com.rsupport.rsperm/
com.siriusapplications.quickboot/
com.skype.raider/
com.softwarebakery.drivedroid/
com.spreaker.android/
com.sylkat.AParted/
com.theolivetree.ftpserver/
com.touchfoo.swordigo/
com.twitter.android/
com.waze/
com.whatsapp/
com.xuecs.ContactHelper/
root@android:/data/data # cd com.
com.AndroidA.ffmpegCodec.armV7n/
com.MediaConverter.ffmpegCodec.armV7n/
com.NxIndustries.Zram/
com.andrewshu.android.reddit/
com.android.LGSetupWizard/
com.android.backupconfirm/
com.android.bluetooth/
com.android.browser/
com.android.calculator2/
com.android.calendar/
com.android.cellbroadcastreceiver/
com.android.certinstaller/
com.android.chrome/
com.android.contacts/
com.android.defcontainer/
com.android.gallery3d/
com.android.htmlviewer/
com.android.inputdevices/
com.android.keychain/
com.android.mms/
com.android.packageinstaller/
com.android.phone/
com.android.providers.applications/
com.android.providers.calendar/
com.android.providers.contacts/
com.android.providers.downloads.ui/
com.android.providers.downloads/
com.android.providers.drm/
com.android.providers.media/
com.android.providers.partnerbookmarks/ com.android.providers.settings/
com.android.providers.telephony/
com.android.providers.userdictionary/
com.android.settings/
com.android.sharedstoragebackup/
com.android.smspush/
com.android.stk/
com.android.systemui/
com.android.vending/
com.android.vpndialogs/
com.android.wallpaper.livepicker/
com.buak.Link2SD/
com.estrongs.android.pop/
com.estrongs.android.taskmanager/
com.farproc.wifi.analyzer/
com.forpda.lp/
com.georgie.SoundWire/
com.google.android.apps.docs/
com.google.android.apps.maps/
com.google.android.apps.plus/
com.google.android.apps.translate/
com.google.android.apps.uploader/
com.google.android.backup/
com.google.android.feedback/
com.google.android.gm/
com.google.android.gms/
com.google.android.googlequicksearchbox/
com.google.android.gsf.login/
com.google.android.gsf/
com.google.android.location/
com.google.android.partnersetup/
com.google.android.setupwizard/
com.google.android.street/
com.google.android.syncadapters.bookmarks/
com.google.android.syncadapters.calendar/
com.google.android.syncadapters.contacts/
com.google.android.tts/
com.google.android.voicesearch/
com.google.android.youtube/
com.googlecode.pythonforandroid/
com.hipipal.qpyplus/
com.hy.system.fontserver/
com.infraware.polarisviewer/
com.itunestoppodcastplayer.app/
com.lexa.fakegps/
com.lge.BtWifiTest/
com.lge.DeviceTest/
com.lge.QuickClip/
com.lge.allautotest/
com.lge.android.atservice/
com.lge.app.floating.res/
com.lge.app.richnote/
com.lge.appbox.bridge/
com.lge.appbox.client/
com.lge.appbox.remote/
com.lge.appwidget.lgsearch/
com.lge.camera/
com.lge.cameratest/
com.lge.clock/
com.lge.defaultaccount/
com.lge.dmf.admin/
com.lge.doubletap/
com.lge.drmservice/
com.lge.email/
com.lge.filemanager/
com.lge.fmradio/
com.lge.hiddenmenu/
com.lge.hiddenpersomenu/
com.lge.homeselector/
com.lge.ime/
com.lge.internal/
com.lge.launcher2.theme.cozywall/
com.lge.launcher2.theme.marshmallow/
com.lge.launcher2.theme.optimus/
com.lge.launcher2/
com.lge.lgdmsclient/
com.lge.lgdrm.permission/
com.lge.lgfota.permission/
com.lge.lginstallservies/
com.lge.lgworld/
com.lge.lockscreen/
com.lge.lockscreensettings/
com.lge.mlt/
com.lge.music/
com.lge.pcsyncui/
com.lge.permission/
com.lge.safetycare/
com.lge.shutdownmonitor/
com.lge.sizechangable.weather.theme.optimus/
com.lge.sizechangable.weather/
com.lge.smartcard.apdu/
com.lge.streamingplayer/
com.lge.sync/
com.lge.systemservice/
com.lge.task/
com.lge.videoplayer/
com.lge.voicerecorder/
com.lge.wapservice/
com.nema.batterycalibration/
com.qualcomm.privinit/
com.quoord.tapatalkpro.activity/
com.rsupport.rs.activity.lge/
com.rsupport.rsperm/
com.siriusapplications.quickboot/
com.skype.raider/
com.softwarebakery.drivedroid/
com.spreaker.android/
com.sylkat.AParted/
com.theolivetree.ftpserver/
com.touchfoo.swordigo/
com.twitter.android/
com.waze/
com.whatsapp/
com.xuecs.ContactHelper/
google <
com.google.android.apps.docs/
com.google.android.apps.maps/
com.google.android.apps.plus/
com.google.android.apps.translate/
com.google.android.apps.uploader/
com.google.android.backup/
com.google.android.feedback/
com.google.android.gm/
com.google.android.gms/
com.google.android.googlequicksearchbox/
com.google.android.gsf.login/
com.google.android.gsf/
com.google.android.location/
com.google.android.partnersetup/
com.google.android.setupwizard/
com.google.android.street/
com.google.android.syncadapters.bookmarks/
com.google.android.syncadapters.calendar/
com.google.android.syncadapters.contacts/
com.google.android.tts/
com.google.android.voicesearch/
com.google.android.youtube/
com.googlecode.pythonforandroid/
droid/ <
root@android:/data/data/com.googlecode.ph
/sdcard/py.sh <
/sdcard/py.sh[12]:
/data/data/com.googlecode.pythonforandroid/files/python/bin/python: not
found
127|root@android:/data/data/com.googlecode.pythonforandroid # cd files
root@android:/data/data/com.googlecode.pythonforandroid/files # cd bin
root@android:/data/data/com.googlecode.pythonforandroid/files/bin # ll
lrwxrwxrwx u0_a100 u0_a100 2015-02-08 21:38 python ->
/data/data/com.googlecode.pythonforandroid/lib/lib0000.so
root@android:/data/data/com.googlecode.ppy.sh
<
/sdcard/py.sh[12]:
/data/data/com.googlecode.pythonforandroid/files/python/bin/python: not
found
127|root@android:/data/data/com.googleco
/sdcard/py.sh <
#! /bin/sh

export EXTERNAL_STORAGE=/sdcard
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/sdcard/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
/data/data/com.googlecode.pythonforandroid/files/python/bin/python "$@"root@android:/data/data/com.googlecode.pythonforandroid/files/bin
#
ls
python
root@android:/data/data/com.googlecode.pythonforandroid/files/bin # ./python
link_image[1891]: 18446 could not load needed library 'libpython2.6.so'
for './python' (load_library[1093]: Library 'libpython2.6.so' not
found)CANNOT LINK EXECUTABLE
255|root@android:/data/data/com.googleco
python <
ELF(P4x4 444

Qtd/system/bin/linker



⎻␉88┬(D≠libpython2.6.so__aeabi_unwind_cpp_pr0Py_Mainlibc.so__libc_initlibstdc++.solibm.solibdl.so__exidx_start__exidx_end__data_start_edata__bss_start__bss_start____bss_end____end__
█ █DQ(T├ \\T

$$GCC: (GNU) 4▼4▼3A(▒␊▒␉␋5TE
▼⎽#⎽├⎼├▒␉▼␋┼├␊⎼⎻▼#▒⎽#▼␍≤┼⎽≤└▼␍≤┼⎽├⎼▼⎼␊┌▼⎻┌├▼├␊│├▼ARM▼␊│␋␍│▼⎻⎼␊␋┼␋├
▒⎼⎼▒≤▼␋┼␋├ ▒⎼⎼▒≤▼°␋┼␋ ▒⎼⎼▒≤▼␌├⎺⎼⎽▼␍≤┼▒└␋␌▼±⎺├▼␌⎺└└␊┼├▼ARM▼▒├├⎼␋␉┤├␊⎽
((L
├├!TT)
▲$$◀2PP@8z p)root@android:/data/data/com.googlecode.pythondcard/p.sh
<
/sdcard/p.sh[12]:
/data/data/com.googlecode.pythonforandroid/files/python/bin/python: not
found
127|root@android:/data/data/com.googlecode.pythonforandroid/files/bin # ll
lrwxrwxrwx u0_a100 u0_a100
20root@android:/data/data/com.googlecode.pythonforandroid/files/bin #
ls python
root@android:/data/data/com.googlecode.pdcard/py.sh
<
/sdcard/py.sh[12]:
/data/data/com.googlecode.pythonforandroid/files/python/bin/python: not
found
127|root@android:/data/data/com.googlecode.pythonforandroid/files/bin #

python-fo...@googlecode.com

unread,
Feb 9, 2015, 3:00:53 PM2/9/15
to python-fo...@googlegroups.com
Comment by nax...@gmail.com:

Oh my god sorry, i have write clear, before the copy/paste... lol
I want delete the previous post..

python-fo...@googlecode.com

unread,
Feb 9, 2015, 3:01:54 PM2/9/15
to python-fo...@googlegroups.com

python-fo...@googlecode.com

unread,
Feb 9, 2015, 3:02:54 PM2/9/15
to python-fo...@googlegroups.com

python-fo...@googlecode.com

unread,
Feb 10, 2015, 9:59:57 PM2/10/15
to python-fo...@googlegroups.com
Comment by keithenb...@gmail.com:

Ok bear with me because I just started learning Python this year. I wrote a
super stupid simple text based game on my computer and i wanted to be able
to play it on my Galaxy S4. I got everything set up but and i found my
script but when i tried to run it i got the following error:

"Traceback (most recent call last):
File "/storage/emulated/0/s14a/scripts/zombie.py", line 85, in <module>
do = input("\n What do you do? ")
File "<string>", line 1, in <module>
NameError: name A is not defined"

The script runs fine on my laptop, any ideas?

python-fo...@googlecode.com

unread,
Feb 10, 2015, 10:13:09 PM2/10/15
to python-fo...@googlegroups.com
Comment by bwanama...@gmail.com:

How do you execute zombie.py on your laptop? From terminal as
$ python zombie.py
or from within a Python interpreter as

python-fo...@googlecode.com

unread,
Feb 10, 2015, 10:18:40 PM2/10/15
to python-fo...@googlegroups.com
Comment by bwanama...@gmail.com:

See https://docs.python.org/2/library/functions.html#input

It is equivalent to

Consider using raw_input() instead

python-fo...@googlecode.com

unread,
Feb 10, 2015, 10:41:12 PM2/10/15
to python-fo...@googlegroups.com
Comment by bwanama...@gmail.com:

From py4a on samsung s5:

what do you do? hi

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module
NameError: name 'hi' is not defined

what to do? hi

'hi'

python-fo...@googlecode.com

unread,
Feb 11, 2015, 3:19:25 PM2/11/15
to python-fo...@googlegroups.com
Comment by keithenb...@gmail.com:

As of right now i've just been running it through Wing IDE.

python-fo...@googlecode.com

unread,
Mar 23, 2015, 3:24:08 PM3/23/15
to python-fo...@googlegroups.com
Comment by wrinkled...@gmail.com:

sed -i -E 's/storage/internal_sd/g' standalone_python.sh

This made it work for me. /mnt/sdcard is a link to /mnt/internal_sd on my
android devices.

python-fo...@googlecode.com

unread,
Mar 23, 2015, 3:39:48 PM3/23/15
to python-fo...@googlegroups.com
Comment by wrinkled...@gmail.com:

sed -i -E 's/internal_sd/sdcard/g' was a change I made to my changed script
for another Android device. You just have to know where your writable
storage is. In this case /mnt/sdcard was a link to
/storage/emulated/legacy/.

python-fo...@googlecode.com

unread,
Mar 23, 2015, 3:40:47 PM3/23/15
to python-fo...@googlegroups.com
Comment by wrinkled...@gmail.com:

sed -i -E 's/internal_sd/sdcard/g' standalone_python.sh

This was a change I made to my previously mentioned change script for
Reply all
Reply to author
Forward
0 new messages