gzip/zlib module Doc bug (1.5.2b2 Library Reference)

Bernhard Reiter bernhard at alpha1.csd.uwm.edu
Mon Apr 5 14:19:02 EDT 1999


I probably encountered a Python Library Reference Documentation bug:

The documentation version February 19, 1999 Release 1.5.2
coming with the windows packages in module gzip reads as follows:

| 7.11 gzip -- gzip compression and
| decompression using files. 
| 
| The data compression provided by the zlib module is compatible with
| that used by the GNU compression program gzip. Accordingly, the gzip
| module provides the GzipFile class to read and write gzip-format
| files, automatically compressing or decompressing the data so it
| looks like an ordinary file object. 

This leaves the impression that the gzip module can decompress
all the files the gzip program can decompress, which is not true.
The gzip program can also deflate data compressed with "compress"
and "pack". The python module cannot do this.


Another weakness in ether the documentation or the module itself is:

| GzipFile ([filename[, mode[, compresslevel[, fileobj]]]]) 
[..]
|      The mode argument can be either 'r' or 'w', depending on
| whether the file will be read or written. The default is the mode of
| fileobj if discernible; otherwise, the default is 'r'. 

This is not true for Windows, where you need and have to use an
additional "b" in the mode argument. At least I needed to do it,
because otherwise I got an Error -5: Hit EOF when reading one file. There was 
probably a binary ^Z in the compressed file that the windows read rountines
took for an EOF, because they were used in text mode.

Both bugs sucked in some of my time. 
I hope this helps to improve!  ;->
	Bernhard




More information about the Python-list mailing list