Decompressing a file retrieved by URL seems too complex

Aahz aahz at
Fri Aug 13 05:24:12 CEST 2010

In article <4c645c39$0$1595$742ec2ed at>,
John Nagle  <nagle at> wrote:
>I'm reading a URL which is a .gz file, and decompressing it.  This
>works, but it seems far too complex.  Yet none of the "wrapping"
>you might expect to work actually does.  You can't wrap a GzipFile
>around an HTTP connection, because GzipFile, reasonably enough, needs
>random access, and tries to do "seek" and "tell".  Nor is the output
>descriptor from gzip general; it fails on "readline", but accepts
>"read". (No good reason for that.) So I had to make a second copy.

Also consider using zlib directly.
Aahz (aahz at           <*>

"...if I were on life-support, I'd rather have it run by a Gameboy than a
Windows box."  --Cliff Wells

More information about the Python-list mailing list