FW: [Pythonmac-SIG] Py2app working with PyQt, PyOpenGL applications? (original) (raw)

Huaicai Mo huaicai at nanorex.com
Fri Nov 19 20:05:35 CET 2004


Bob,

Thank you very much for the reply. As you suggested, I tried "--packages OpenGL", which will solve the OpenGL version problem, but I still got the error: "QPaintDevice: Must construct a Qapplication before a QPaintDevice."

I don't think it's any problem of my scripts, it works without any problem if I start it manually in a shell window, and the same program works on Linux and Windows too. I suspect the problem is the way how py2app deals with PyQt/Qt modules. I noticed in the result package, it includes qt.so, qtgl.so, sip.so in the lib-dynload directory, and qt.pyc, qtgl.pyc, sip.pyc in the site-packages.zip file, but no where I can find anything about libqt.3.dylib and libqui.1.dylib in the package, I guess they are Qt libraries, which are needed to run my program.

In the package that I created on Windows using py2exe, similar files exist: *.pyc in a zip file, and corresponding *.dll files outside, but there is one more dll file called: qt-mt333.dll, the Qt library file on Windows. I tried to copy those *.dylib files into the lib-dyload directory, but no success. I wonder if you have any work around for this problem at present? Thanks a lot,

Regards,

Huaicai


From: Bob Ippolito [mailto:bob at redivi.com] Sent: Friday, November 19, 2004 11:21 AM To: Huaicai Mo Cc: pythonmac-sig at python.org Subject: Re: [Pythonmac-SIG] Py2app working with PyQt, PyOpenGL applications?

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 -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythonmac-sig/attachments/20041119/f47d5d77/attachment.htm



More information about the Pythonmac-SIG mailing list