py2exe and CD-ROM ISO Level 1

Thomas Heller theller at python.net
Fri Oct 29 03:45:07 EDT 2004


Werner Merkl <werner_DOT_merkl_ at _fujitsu_DASH_siemens.com> writes:

> Hi,
>
> I recompiled my application as a console program and got following
> error message:
>
> -----------------------------------------------------------------------
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> C:\>e:\AUTORUN.EXE
> Traceback (most recent call last):
>    File "D:\PROGS\Python23\lib\site-packages\py2exe\boot_common.py",
>    line 69, in ?
>      import linecache
> zipimport.ZipImportError: can't decompress data; zlib not available
> Traceback (most recent call last):
>    File "AutoRun.py", line 54, in ?
> zipimport.ZipImportError: can't decompress data; zlib not available
> -----------------------------------------------------------------------
>
> so I removed "compressed": 1, from setup.py and it WORKS!!!

Great!

> This seems to be a bug in py2exe ????

The zlib module is the only one that is imported with the standard
mechanism, since it is imported when a zipfile is added to sys.path.
So, when it's filename has the wrong case the import will fail, and the
only solution would be to set PYTHONCASEOK=1 before.  Unfortunately,
this cannot be done somewhere in your Pythoncode, because it's too late
then.  So, if you insist on 'compressed': 1 (but why would you?) the
only solution that I see is to add
     _putenv("PYTHONCASEOK=1");
to the source file start.c, somewhere in the init_with_instance
function, near line 135, and rebuild py2exe.

Thomas



More information about the Python-list mailing list