[Pythonmac-SIG] Trials with building app

Chris Weisiger cweisiger at msg.ucsf.edu
Mon Sep 13 23:20:59 CEST 2010


Just another update on my travails with making an app build with py2app.
Since my previous posts haven't attracted much attention, I'm primarily
posting this on the off-chance that someone else is having similar issues
and might be helped. However, please do speak up if you have something to
contribute! I'm starting to get a wee bit frustrated.

Things I have discovered (some of this is a recap):

To build with a nonstandard Python install (necessary to get py2app to
include the Python interpreter in the build), I have to "create" a main-i386
app template. This is done by going into
py2app-0.5.2-py2.5.egg/py2app/apptemplate/prebuilt and doing "ln -sf
main-fat3 main-i386"

This will allow py2app to build the app. However, it won't run, because I
have a dependency on a .so file which isn't in the default search paths that
py2app sets up. So I have to modify __boot__.py by adding this line to the
run() function right after it imports sys:
sys.path.insert(0, os.path.join(os.getcwd(), 'lib', 'python2.5',
'lib-dynload'))

That code actually isn't reachable yet, though (I know I have to fix it
because my previous nominally-successful builds weren't standalone and thus
made it further). Instead, I get this error when __boot__.py's
_chdir_resource() function tries to import the os module:
zipimport.ZipImportError: can't decompress data; zlib not available

zlib is present:
% find dist -name "zlib*"
dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/zlib.so

However, it's clearly not in the search path at this point -- and the
program can't import os to change its search path! I can find a copy of
os.py from my /Library/Frameworks and insert it at the same level as
__boot__.py, and it will find that -- then fail to load posixpath with the
same zlib error (and then stat when I add posixpath, etc.). If I manually
uncompress lib/python2.5/site-packages.zip and copy eveyrthing in it
(including directories) down two levels to the Resources directory, then
everything seems to go fine until my app tries to import wx, at which point
this happens:

ImportError:
dlopen(/Users/chriswei/proj/ucsf/bitbucket-repo/processor/dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/wx/_core_.so,
2): no suitable image found.  Did find:
/Users/chriswei/proj/ucsf/bitbucket-repo/processor/dist/processor.app/Contents/Resources/lib/python2.5/lib-dynload/wx/_core_.so:
no matching architecture in universal wrapper

And that's where I'm stuck now. I've found shreds and snippets of
similar-sounding problems from other users, but no indication of what fixed
things for them. The py2app trac site is down -- is it even supported any
more? If not, what's the plan for standalone Python programs on OSX going
forward?

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


More information about the Pythonmac-SIG mailing list