[Pythonmac-SIG] Problems with py2app and wx on leopard
James Kelly
JKelly at nemetschek.net
Wed Aug 13 23:05:12 CEST 2008
Okay, with the benefit of some sleep, I've been able to resolve this
problem. I'll recount what was wrong below for the benefit of others. To
clear up what was probably a confusing email based on Chris's response, I
was tring to use the python.org python, not the system python, but there
were some problems, mostly caused by some stupid moves on my part while
trying to solve other problems.
The problem I had was that I had added the system python site-packages to my
$PYTHONPATH, so it makes sense now why py2app was looking in there. Perhaps
a little odd that it was sucking up two versions of wx libraries, but it
seems a plausible explanation as the the behavior I was seeing. Do
something dumb while debugging, get dumb results. :)
So then, after getting the py2app and related dependencies from svn, the app
actually built.
I then had another issue. First, I tried to run the app on Tiger, and it
was not happy about the version of libiconv. No problem, I built the app on
Tiger. We've had to do this before, so it didn't phase me too much. When I
build on Tiger, and run on leopard, it complains: Library not loaded:
@executable_path/../Frameworks/libwx_macud-2.8.0.dylib. It goes on to say
that the reason is that the image is not found. But it is indeed there, in
the app bundle, with read and execute permissions for all.
With the app bundle built on Tiger and run on Tiger, I get an os import
error.
It turns out this was related to our use of the Authorization module. We
were just passing sys.argv[0] into executeWithPrivileges, which, as it makes
sense now, was just the path to our primary python file in the Resources
directory. I tried a few things here, using /usr/bin/open on the app bundle
for example, but in the end what worked properly is passing the path to the
app itself in side Contents/MacOS.
This clears up all the issues above. Anyway, if there is any lesson to be
learned from this, it's that marathon debugging sessions are a bad idea.
You just keep doing increasingly stupid things until you wrap yourself in a
circle. :)
Jim
On 8/13/08 2:09 AM, "Jim Kelly" <JKelly at nemetschek.net> wrote:
> I'm experiencing a bit of odd behavior with py2app and wx. The shared
> object files from wx, when inspected with otool, are looking for:
>
> /usr/lib/libwx_macud-2.8.0.dylib (compatibility version 2.6.0, current
> version 2.8.4)
>
> That is based on wx installed in the site-packages of the system python that
> ships with leopard.
>
> Now I installed python from python.org, got wxPython source, and tried
> again. This time, in my wx directory, otool shows no such requirement.
> That's what I want, so that works well.
>
> But it turns out that py2app was still pulling from the system wx. So I set
> use_pythonpath to True, thinking it would prefer mine over the system one.
> Now it is including *both*, mine goes to Frameworks in the app bundle, while
> the system one goes into Resources in the app bundle. At runtime, if I'm
> running on a system without the libwx_macud-2.8.0.dylib file, it still
> fails. This is what I am seeing when I grep for _windows_ (one of the so
> files from wx) from my py2app build output:
>
> byte-compiling
> /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/bui
> ld/bdist.macosx-10.3-i386/python2.5-standalone/app/temp/wx/_windows_.py to
> wx/_windows_.pyc
> copying
> /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/w
> x-2.8-mac-unicode/wx/_windows_.so ->
> /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/dis
> t_osx/VWInstaller.app/Contents/Resources/lib/python2.5/lib-dynload/wx
> copying
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-package
> s/wx-2.8-mac-unicode/wx/_windows_.so ->
> /Users/jkelly/Documents/Code/Projects/Installer/Dev/demo/demovwinstaller/dis
> t_osx/VWInstaller.app/Contents/Frameworks
> stripping _windows_.so
>
> So how do I make py2app ignore the system install version of wx completely?
>
> Thanks!
> Jim
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
More information about the Pythonmac-SIG
mailing list