This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author francescor
Recipients francescor
Date 2008-12-10.16:27:45
SpamBayes Score 1.0866497e-06
Marked as misclassified No
Message-id <1228926467.09.0.231688302794.issue4621@psf.upfronthosting.co.za>
In-reply-to
Content
Each entry of a zip file, as read by the zipfile module, can be accessed
via a ZipInfo object. The filename attribute of ZipInfo is a string.
However, the read method of a ZipFile object expects a binary as
argument, or at least this is what I can deduct from the following behavior:

>>> import zipfile
>>> testzip = zipfile.ZipFile('test.zip')
>>> t1 = testzip.infolist()[0]
>>> t1.filename
'tést.xml'
>>> data = testzip.read(testzip.infolist()[0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python30\lib\zipfile.py", line 843, in read
    return self.open(name, "r", pwd).read()
  File "C:\Python30\lib\zipfile.py", line 883, in open
    % (zinfo.orig_filename, fname))
zipfile.BadZipfile: File name in directory 'tést.xml' and header
b't\x82st.xml' differ.

The test.zip file is attached as help in reproducing this error.
History
Date User Action Args
2008-12-10 16:27:47francescorsetrecipients: + francescor
2008-12-10 16:27:47francescorsetmessageid: <1228926467.09.0.231688302794.issue4621@psf.upfronthosting.co.za>
2008-12-10 16:27:46francescorlinkissue4621 messages
2008-12-10 16:27:45francescorcreate