[Tutor] Reading gzip files

Dinesh B Vadhia dineshbvadhia at hotmail.com
Mon Dec 1 03:42:04 CET 2008

Hi Alan

A bunch of gzipped files are read with the majority working but a few don't.  I don't know if these files were originally zipped with gzip but I'd guess that they were.

Strangely, for the files that don't work I can read/print the file almost to the end and then it falls over with the CRC error.



Message: 5
Date: Mon, 1 Dec 2008 00:57:04 -0000
From: "Alan Gauld" <alan.gauld at btinternet.com>
Subject: Re: [Tutor] Reading gzip files
To: tutor at python.org
Message-ID: <ggvcov$eio$1 at ger.gmane.org>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";

"Dinesh B Vadhia" <dineshbvadhia at hotmail.com> wrote

> I'm reading gzip files and writing the content out to a text file 
> line by line.
>  File "C:\Python25\lib\gzip.py", line 275, in _read
>    self._read_eof()
>  File "C:\Python25\lib\gzip.py", line 311, in _read_eof
>    raise IOError, "CRC check failed"
> IOError: CRC check failed
> I've checked the Python docs and online but cannot find a
> solution to the problem.  Thanks.

At great risk of stating the obvious but have you actually checked
that the CRC of the gzipped file is correct? Does the problem only
happen with this file or with all gzipped files?

And are the files actually zipped by gzip or by some other
"compatible" program? If other does it work for genuine
gzipped files?

Just some ideas to play with.

Alan G 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081130/8e9c4e49/attachment.htm>

More information about the Tutor mailing list