[Pythonmac-SIG] Py2app zlib import error
Ronald Oussoren
ronaldoussoren at mac.com
Tue Jun 28 14:20:57 CEST 2011
On 23 Jun, 2011, at 18:18, Brian Zambrano wrote:
> It smells of a py2app issue to me as well...something with the path settings.
Something else to try: there is an __boot__.py inside the generated application bundle. Add the following line to the top of that file:
import sys; print (sys.path)
Then launch the application from the command-line: dist/test2pyapp.app/Contents/MacOS/testpy2app
This should print the value of Python's search path in the terminal. The entries of that list should refer to ".../Resources/lib/python2.6", ".../Resources/lib/python2.6/lib-dynload" and ".../Resources/lib/python2.6/site-packages.zip".
Given your problem sys.path either doesn't contain the lib-dynload entry, or the lib-dynload entry is after the entry for site-packages.zip. Both of which would be bugs in py2app.
As a quick workaround it should be possible monkeypatch sys.path in __boot__.py, that way you can at least launch the application while we look for a proper solution.
Ronald
>
> I don't have macports installed on this machine, so that's definitely not it.
>
> The exact same error happens when doing a hello world program with py2app. The setup file, unaltered:
>
> """
> This is a setup.py script generated by py2applet
>
> Usage:
> python setup.py py2app
> """
>
> from setuptools import setup
>
> APP = ['testpy2app.py']
> DATA_FILES = []
> OPTIONS = {'argv_emulation': True}
>
> setup(
> app=APP,
> data_files=DATA_FILES,
> options={'py2app': OPTIONS},
> setup_requires=['py2app'],
> )
>
> Launching the compiled app throws the same zlib error. I guess I'll need to start digging through py2app source and figure out where this bug is coming from.
>
> BZ
>
>
> On Thu, Jun 23, 2011 at 9:04 AM, Chris Barker <Chris.Barker at noaa.gov> wrote:
> On 6/22/11 7:30 PM, Brian Zambrano wrote:
> Just bumping this. Does anyone have solution or some advice on how to
> proceed?
>
> The error is:
>
> 'import site' failed; use -v for traceback
> ...
>
> zipimport.ZipImportError: can't decompress data; zlib not available
>
> This looks like it has nothing to do with PyQT or anything else, actually, but is a raw py2app issue. So the first thing I'd do is try a really simple example. That will make it easier for others to try and reproduce the failure as well.
>
> Taking a guess, I'd say you're getting a zlib from macports that may rely on something else in macports that other users don't have.
>
> Again, I"'d avoid macports for something you want to re-distribute.
>
>
> -Chris
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R (206) 526-6959 voice
> 7600 Sand Point Way NE (206) 526-6329 fax
> Seattle, WA 98115 (206) 526-6317 main reception
>
> Chris.Barker at noaa.gov
>
> _______________________________________________
> Pythonmac-SIG maillist - Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20110628/dd051bbc/attachment-0001.html>
More information about the Pythonmac-SIG
mailing list