Unzipping a .zip properly, and from a remote URL

Christopher Culver crculver at christopherculver.com
Tue Feb 3 14:38:09 CET 2009


Tino Wildenhain <tino at wildenhain.de> writes:
> so instead you would use archive = zipfile.ZipFile(remotedata)

That produces the following error if I try that in the Python
interpreter (URL edited for privacy):

>>> import zipfile
>>> import urllib2
>>> remotedata = urllib2.urlopen("http://...file.zip")
>>> archive = zipfile.ZipFile(remotedata)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/zipfile.py", line 346, in __init__
    self._GetContents()
  File "/usr/lib/python2.5/zipfile.py", line 366, in _GetContents
    self._RealGetContents()
  File "/usr/lib/python2.5/zipfile.py", line 376, in _RealGetContents
    endrec = _EndRecData(fp)
  File "/usr/lib/python2.5/zipfile.py", line 133, in _EndRecData
    fpin.seek(-22, 2)               # Assume no archive comment.
AttributeError: addinfourl instance has no attribute 'seek'



More information about the Python-list mailing list