[Pythonmac-SIG] py2app program unable to find files in lib-dynload

Chris Weisiger cweisiger at msg.ucsf.edu
Fri Sep 10 20:25:29 CEST 2010


I have a program that depends on wx, Paramiko (remote server access via SSH)
and Crypto (same). Running py2app for this program generates an app
(creatively named "processor.app") that errors out on running with this
error:

ImportError:
'/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/Crypto/Hash/SHA256.so'
not found

SHA256.so does exist, in
./dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/Crypto/Hash/SHA256.so

This error message is generated by SHA256.py, which I can only find here:

build/bdist.macosx-10.5-i386/python2.5-semi_standalone/app/temp/Crypto/Hash

The code in SHA256.py appears to be intended to find the first match in
sys.path that has 'Crypto/Hash/SHA256.so'. However, it raises an ImportError
if the first entry in sys.path that ends with 'lib-dynload' doesn't have
that file, and there's a bogus else statement after the for loop. I'm amazed
it's even passing syntax checks. I've pasted the file online here:

http://paste.ubuntu.com/491717/

This file is (I think) run after the build directory is created as part of
creating the dist directory, which doesn't leave me a window to insert
debugging code to figure out what it's doing wrong -- at least, I don't see
an option for py2app to make the build directory but not the dist directory,
and then as a second step to make the dist directory based on the build
directory. I can fix it to make a launchable application by hacking
__boot__.py to add this line to _run():

sys.path.insert(0, os.path.join(os.getcwd(), 'lib', 'python2.5',
'lib-dynload'))

Appending the path to the end of sys.path doesn't work because SHA256.py
only checks the first path entry that ends with 'lib-dynload', which is a
/System directory. The path I am inserting here is not otherwise included in
sys.path either, so without this hack it's physically impossible for py2app
apps to find anything put into their lib-dynload directories.

I've uploaded a tarball of the app here:

http://derakon.dynydns.org/~chriswei/temp2/processor.tgz

Here's a paste of the entire output of 'python setup.py py2app':

http://paste.ubuntu.com/491723/

And here's a paste of the complete error message when I try to run the
unmodified program:

http://paste.ubuntu.com/491724/

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20100910/00ef30da/attachment.html>


More information about the Pythonmac-SIG mailing list