[issue11608] GzipFile cannot be used for streaming
Enrico Zini
report at bugs.python.org
Sat Mar 19 17:18:50 CET 2011
New submission from Enrico Zini <enrico at enricozini.org>:
Hello,
this snippet does not work, because GzipFile wants a file-like object that can do tell() and seek():
#!/usr/bin/python
import gzip
from urllib import urlopen
zfd = urlopen("http://ftp.debian.org/debian/dists/sid/Contents-udeb.gz")
fd = gzip.GzipFile(fileobj=zfd, mode="r")
for line in fd:
foobar(line)
It must be possible to build a decompressing file-like object wrapper that can do without seeking, since it is obviously not a limitation of gzip decompression libraries. It would be extremely useful to have such a thing, as shown in the example snippet above.
Some more details (including a very annoying misrepresentation of the issue found in Dive Into Python) can be found at http://www.enricozini.org/2011/cazzeggio/python-gzip/ (I apologise about the ranting tone of the post).
----------
components: Library (Lib)
messages: 131427
nosy: enrico
priority: normal
severity: normal
status: open
title: GzipFile cannot be used for streaming
type: behavior
versions: Python 2.5, Python 2.6, Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11608>
_______________________________________
More information about the Python-bugs-list
mailing list