New submission from Francesco Ricciardi <[EMAIL PROTECTED]>:

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.

----------
components: Library (Lib)
files: test.zip
messages: 77555
nosy: francescor
severity: normal
status: open
title: zipfile returns string but expects binary
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file12319/test.zip

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4621>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to