Issue11608
Created on 2011-03-19 16:18 by enrico, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg131427 - (view) | Author: Enrico Zini (enrico) | Date: 2011-03-19 16:18 | |
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).
|
|||
| msg131482 - (view) | Author: ysj.ray (ysj.ray) | Date: 2011-03-20 09:49 | |
Looks like a duplicate issue of #9664 and #914340. And has been fixed in patch of #914340. |
|||
| msg131545 - (view) | Author: Ned Deily (ned.deily) * ![]() |
Date: 2011-03-20 21:28 | |
As Ray points out, this feature is now available in Python 3.2. It was not backported to Python 2.7 as only bug fixes are now being accepted for Python 2.x, not new features. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:15 | admin | set | github: 55817 |
| 2011-03-20 21:28:29 | ned.deily | set | status: open -> closed superseder: gzip.GzipFile to accept stream as fileobj. nosy:
+ ned.deily |
| 2011-03-20 09:49:46 | ysj.ray | set | nosy:
+ ysj.ray messages: + msg131482 |
| 2011-03-20 07:12:21 | nadeem.vawda | set | nosy:
+ nadeem.vawda |
| 2011-03-19 19:32:14 | stutzbach | set | nosy:
+ stutzbach |
| 2011-03-19 16:18:48 | enrico | create | |
