sinkuri256 / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

import hashlib crashes sl4a #490

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What device(s) are you experiencing the problem on?

Nexus S

What firmware version are you running on the device?

2.3 (GRH55)

What steps will reproduce the problem?

The following python program exits without an error message but also without 
executing the 2nd print statement

--------
print "hello"
import hashlib
print "hashlib imported"

What is the expected output? What do you see instead?

Only "hello" is printed.

Please provide any additional information below.

logcat -d attached

Original issue reported on code.google.com by ferg...@gmail.com on 18 Dec 2010 at 10:49

Attachments:

GoogleCodeExporter commented 9 years ago
Seeing the same thing on my nexus S running 2.3.

Original comment by willrobi...@gmail.com on 30 Dec 2010 at 1:17

GoogleCodeExporter commented 9 years ago
Works fine for me, both in emulator and my HTC Desire.

Just a thought, though: what is the default path for the sdcard on these 
devices?

Mine is /sdcard (or possibly /mnt/sdcard)...
Frank was having trouble running "pydoc", and I see on his traceback that the 
files are being stored on "/storage" ... wonder if python is having trouble 
finding the extras directory? Or if there's a hardcoded "/sdcard" somewhere in 
the source?

You should be able to check:

import os
print os.environ['PYTHONPATH']

Should produce something like:
/mnt/sdcard/com.googlecode.pythonforandroid/extras/python

Check with a file browser to see if the extra libs are in fact installed there.
If not, that may be the problem.

Original comment by rjmatthews62 on 30 Dec 2010 at 4:24

GoogleCodeExporter commented 9 years ago
Another thought... hashlib uses a C library.
What processor does the Nexus S use?

Original comment by rjmatthews62 on 30 Dec 2010 at 4:43

GoogleCodeExporter commented 9 years ago
I get both printed lines on my Archos 5 Android 1.6.

Robbie's path script shows "/storage/...".

I might not have mentioned it but I don't know Linux. I vaguely recall that 
there are two or three ways to call a mounted volume, depending on the OS. On 
my system /storage and /sdcard are the same. I'm only guessing that /sdcard is 
the existing file which serves as the mounted volume, and that /storage is the 
fictitious name being used as a redirection to that file. I might have this 
backwards though, or perhaps a little sideways. I dearly hope a LUnix guru will 
clarify this. I don't have root so I can learn very little from experimentation.

Frank

Original comment by frank.we...@gmail.com on 30 Dec 2010 at 3:24

GoogleCodeExporter commented 9 years ago
rjmatthews62, I've confirmed that the PYTHONPATH environment variable looks 
sane and that the Python libs are in fact installed there.

Your follow-up message is closer to the mark, I think.  If you look at the 
stack traces, they're segfaulting within the hashlib library, not failing to 
find some library.  I was going to try recompiling the Python for my phone, but 
the process was a bit involved and I was hoping that someone who already had 
the environment set up (and has a nexus S and/or android 2.3) could give it a 
try instead.

Will

Original comment by willrobi...@gmail.com on 30 Dec 2010 at 5:28

GoogleCodeExporter commented 9 years ago
Working on a python version for gingerbread (2.3).
There are some incompatibilities with the dynamic libraries, so things like 
hashlib and urllib2 won't load.

Original comment by rjmatthews62 on 8 Jan 2011 at 12:39

GoogleCodeExporter commented 9 years ago
rjmatthews62, any update on this?

Thanks,
Will

Original comment by robin...@google.com on 14 Feb 2011 at 5:01

GoogleCodeExporter commented 9 years ago
Did you try with the new python-for-android project? 
http://code.google.com/p/python-for-android/

Original comment by naranjo....@gmail.com on 14 Feb 2011 at 6:01

GoogleCodeExporter commented 9 years ago
Fixed in latest python build.
See: http://code.google.com/p/python-for-android/

Original comment by rjmatthews62 on 17 Mar 2011 at 10:40