Author lucas_malor
Recipients
Date 2007-03-15.18:30:39
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I applied the patch by hand, I think the problem is simply it's for python 2.6 (I have the stable 2.5 version)

Anyway like I wrote for an old similar patch of another user, the patch starts to read the header at the current position, and not at the start of the file. You can see it trying this piece of code:

---------------------------------------
import urllib2
import array
import gzip

urlfile = urllib2.urlopen(someurl)
header = array.array("B")
header.fromstring(urlfile.read(1))

gzfile = gzip.GzipFile(fileobj=urlfile)
print gzfile.read()
-----------------------------------------

Error:
------------------------------------------------------------------------------
  File "c:\My Programs\Python\lib\gzip.py", line 285, in read
    self._read_gzip_header(self.fileobj)
  File "c:\My Programs\Python\lib\gzip.py", line 177, in _read_gzip_header
    raise IOError, 'Not a gzipped file'
IOError: Not a gzipped file
>Exit code: 1
------------------------------------------------------------------------------

I don't know how you can solve this without seek()

Anyway if you are interested I created the diff for Python 2.5 :

http://digilander.libero.it/LucasMalor/gzip_2.5.py.diff.gz
History
Date User Action Args
2007-08-23 15:57:20adminlinkissue1675951 messages
2007-08-23 15:57:20admincreate