[Pythonmac-SIG] Py2app working with PyQt, PyOpenGL applications?

Bob Ippolito bob at redivi.com
Fri Nov 19 17:21:21 CET 2004


On Nov 19, 2004, at 5:56 PM, Huaicai Mo wrote:

> I am trying to use py2app to build an application bundle distribution 
> on Mac OS X. I got some problems, I wonder if any one has similar 
> experiences or any ideas for these?
>
> My Mac OS X is 10.2.8. I built py2app from source, since the 
> py2app-0.1.5 installation package needs 10.3 installer. My software 
> uses PyQt, PyOpenGL packages. Same as py2exe, py2app can't find the 
> "sip" module, which is used by PyQt,  so I add the option: "--includes 
> sip", this works fine, but the problem is when I run the application, 
> I got an error:

The next version of py2app will include workarounds for PyQt and 
PyOpenGL, assuming that an easy-ish to install version of PyQt is 
available by the time I do it.  I'll probably release a new version of 
py2app in two or three weeks.  Until then, PyQt is completely untested 
and I can't really help you with anything PyQt specific.

> IOError: [Errno20] Not a directory: 
> '…./Contents/Resources/Python/site-packages.zip/OpenGL/version'. 
>
>  I tried to add the file 'version' from OpenGL directory to 
> site-packages.zip and extract the zip file into a directory called 
> site-packages.zip, the above error disappeared, but I got an new 
> error:

Don't do that.

>  QPaintDevice: Must construct a Qapplication before a QPaintDevice.  
> My application works fine and doesn't have such errors if I just start 
> it from a shell window like: pythonw …./myapp.py.

This sounds like an error in your script or something, I can't help you 
with that.  Maybe using --packages for sip and PyQt (whatever the 
package names are called) will fix this?  I haven't looked at PyQt in 
quite some time and have no idea what nasty hacks it uses.

> I also tried  "--excludes OpenGL" module and then manually copy the 
> OpenGL directory  from Python.frameworks to "site-pakcages.zip" and 
> "lib-dynload" directories, the trick that I used for py2exe on 
> Windows, but it seems this is not

Either hack the OpenGL __init__ to use a sane method to acquire its 
version, or use --packages OpenGL to include the package as-is (out of 
the zip)

>  working here: " Fatal Python error: Interpreter not initialized 
> (Version mismatch?) "

This is because Python itself is included in your application, but the 
OpenGL extension links directly to your 
/LIbrary/Frameworks/Python.framework.  It explodes because once you 
load that extension, you have *TWO* Python libraries in your process.  
When using py2app correctly (i.e. not hacking around the application 
bundles on your own!) it will automatically take care of this for you 
by rewriting the Mach-O load commands to point to your in-bundle 
Python.

-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3189 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20041119/f0c10933/attachment.bin


More information about the Pythonmac-SIG mailing list