[New-bugs-announce] [issue9664] Make gzip module not require that underlying file object support seek

Matthias Klose report at bugs.python.org
Mon Aug 23 10:06:50 CEST 2010


New submission from Matthias Klose <doko at debian.org>:

[ forwarded from http://bugs.debian.org/571317 ]


"I'm writing a program that uses the popularity contest results.  Since
downloading the compressed results takes about a quarter of the time
it takes to download the uncompressed results, I'd like to use the
following construct to iterate over the results:

 for line in gzip.GzipFile(fileobj=urllib.request.urlopen('http://popcon.debian.org/by_vote.gz')):

Unfortunately, this fails with the following exception:

 Traceback (most recent call last):
   File "/home/kraai/bin/rc-bugs", line 76, in <module>
     main()
   File "/home/kraai/bin/rc-bugs", line 56, in main
     for line in gzip.GzipFile(fileobj=urllib.request.urlopen('http://popcon.debian.org/by_vote.gz')): 
   File "/usr/lib/python3.1/gzip.py", line 469, in __next__
     line = self.readline()
   File "/usr/lib/python3.1/gzip.py", line 424, in readline
     c = self.read(readsize)
   File "/usr/lib/python3.1/gzip.py", line 249, in read
     self._read(readsize)
   File "/usr/lib/python3.1/gzip.py", line 277, in _read
     pos = self.fileobj.tell()   # Save current position
 io.UnsupportedOperation: seek

I wish that the gzip module didn't require the underlying file object
to support seek so that this construct would work."

----------
messages: 114728
nosy: doko
priority: normal
severity: normal
status: open
title: Make gzip module not require that underlying file object support seek
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9664>
_______________________________________


More information about the New-bugs-announce mailing list