[Python-Dev] zipfile.py and InfoZIP files

M.-A. Lemburg mal@lemburg.com
Fri, 03 Nov 2000 20:08:17 +0100


I'm having trouble opening ZIP files created using InfoZIP's
zip utility (which uses zlib) with zipfile.py:

>>> x = z.read('README')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/home/lemburg/lib/zipfile.py", line 242, in read
    bytes = dc.decompress(bytes)
zlib.error: Error -3 while decompressing: incomplete dynamic bit lengths tree

Is this due to the installed zlib on my system being incompatible,
or is this a bug in zipfile.py ? I have libz version 1.1.3 and
zip version 2.2.

Also, I wonder why zipfile forces the mode flag to be 'r',
'w' and 'a' -- wouldn't it make more sense to only add 'b', etc.
to the mode flag instead ?!

The ZipFile is also missing some kind of method which
extracts files in the ZIP archive to a file-like object. This
would be very useful for extracting large files from a ZIP
archive without having to first read in the whole file into
memory.

Thanks,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/