zipfile (Python 2.0) incompatible with InfoZip 2.3?

Thomas Heller thomas.heller at ion-tof.com
Thu Apr 19 09:04:11 EDT 2001


Jim Ahlstrom posted the following message to python-dev
some days ago:

> The zipfile module seems to have been well received, and
> I have the impression that many people are using it.  But
> I have been getting complaints that it won't read ZIP files
> created by InfoZip.  At first I thought this was a problem
> with incompatible zlib compression versions, but now I have
> found the problem.
>
> It turns out that InfoZip's Wiz version 5.02 (and maybe other
> InfoZip versions) creates ZIP files with an incorrect value
> for "extra data length" in the central directory, but the correct
> value in the file header.  The "extra data" is before the compressed
> file data, and so this causes the file data offset to be off slightly
> thus causing complaints from the zlib decompressor.  I changed
> zipfile.py to use the file header value, and it fixes the problem.
>
> I also added a new method restore(self, name, fileobject) which
> was suggested some time ago by MAL.  It writes to an open file
> or any other object with a write() method.  It avoids the need
> to read the whole file into memory.
>
> I also changed the "raise" statements to use the "zipfile.error"
> exception.  This agrees with the documentation, but previously
> zipfile raised a variety of exceptions.  This also fixes the
> complaint that "BadZipfile" should be spelled "BadZipFile".
>
> The new changed zipfile.py is available from
>             ftp://ftp.interet.com/pub/zipfile.py
> and is currently being tested by a user.  Please take a look.
>
> JimA
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev





More information about the Python-list mailing list