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 pysquared
Date 2007-08-15.22:37:50
SpamBayes Score
Marked as misclassified
Allow open() 'name' parameter to be a ZipInfo object, which allows opening archive members with duplicate filenames.  Also allow read() 'name' parameter to be a ZipInfo object, as it calls open() directly.

I got sent a zip file which had duplicate names in it, and the only way I could see to extract it using was to apply this patch.

The infolist() and namelist() methods will return information for duplicate filenames, but the open() method takes only a name.

This patch also updated the docs for

Python 2.1 -> 2.5 module does not have an open() method, but it would be trivial to backport this patch to enhance the read() method.

# Test:
# write() optionally warns, but still allows,
# creating duplicate file names:
import zipfile
zf = zipfile.ZipFile('', 'w')
zf.debug = 1
zf.writestr('dupname', 'Hello')
zf.writestr('dupname', 'World')
# Print 'Hello' 'World'
zfr = zipfile.ZipFile('', 'r')
for inf in zfr.infolist():
  print repr(
Date User Action Args
2007-08-23 15:59:41adminlinkissue1775025 messages
2007-08-23 15:59:41admincreate