zlib and zip files

Michael Ekstrand michael at elehack.net
Fri Apr 14 10:46:38 EDT 2006


Jan Prochazka wrote:
> Hi,
> I need to decompress zip archive. I wrote a parser of zip file, i obtain
> the compressed data, but when i call zlib.decompress(data) on them,
> it throws this error:
> 
> decbuf = decompressor.decompress(compressed_data)
> 
> error: Error -3 while decompressing: unknown compression method
> 
> I try to compress by zlib the same data which are in that file, the
> result was 6 bytes bigger, '\x78\xda' on begin and '\xc9\x1f\x87\x0b' on end
> when i tried to put this extending data to zlib decompressor, it
> decompress some files of zip archive, but it fails, when i try to
> decompress 100MB file from archive
> 
> could you help, please?

The zlib module is for reading and writing the gzip compression format, 
used by the gzip program; it is not the same as a zip archive a la 
PKZip.  The zipfile module will let you read and write zip archives.

- Michael

-- 
mouse, n: a device for pointing at the xterm in which you want to type.
         -- Fortune
Visit me on the Web: http://www.elehack.net



More information about the Python-list mailing list