Message115122
I do not think your wish is sensibly possible. GzipFile wraps an object that is or simulates a file. This is necessary because GzipFile "simulates most of the methods of a file object, with the exception of the readinto() and truncate() methods." Note that seek, rewind, and tell are not excluded. For instance, I see no way that this:
def rewind(self):
'''Return the uncompressed stream file position indicator to the
beginning of the file'''
if self.mode != READ:
raise IOError("Can't rewind in write mode")
self.fileobj.seek(0)
...
could be implemented without seek, and without having a complete local copy of everything read.
urllib.request.urlopen returns a 'file-like' object that does not quite fully simulate a file. The downstream OP should save the gzip file locally using urlretrieve() and *then* open and iterate through it. Feel free to forward this suggestion to the OP. |
|
Date |
User |
Action |
Args |
2010-08-27 19:39:45 | terry.reedy | set | recipients:
+ terry.reedy, doko |
2010-08-27 19:39:45 | terry.reedy | set | messageid: <1282937985.79.0.426695158453.issue9664@psf.upfronthosting.co.za> |
2010-08-27 19:39:43 | terry.reedy | link | issue9664 messages |
2010-08-27 19:39:42 | terry.reedy | create | |
|