Decompressing a file retrieved by URL seems too complex

Aahz aahz at pythoncraft.com
Thu Aug 12 23:24:12 EDT 2010


In article <4c645c39$0$1595$742ec2ed at news.sonic.net>,
John Nagle  <nagle at animats.com> 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 pythoncraft.com)           <*>         http://www.pythoncraft.com/

"...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