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 markaflacy
Recipients
Date 2007-05-01.16:43:50
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
In short, ZipFile() will not write the Central Directory entry unless you have added a file to it.  That makes it impossible to create a valid empty zip archive.

In one of my applications, I have the need to extract a partial set of information from one zip file and insert it into another.  There are valid use cases where the source zip archive will not have any of the files which I am looking for.  In Python 2.4, I would end up with an empty file which was considered to be a valid empty zip archive.  In Python 2.5, an empty file is not considered a valid zip archive.  

One would reasonably expect that creating a new ZipFile(mode="r") and successfully closing it without writing any entries would result in a valid zip archive that could be re-opened later without throwing an exception.

History
Date User Action Args
2007-08-23 14:53:30adminlinkissue1710703 messages
2007-08-23 14:53:30admincreate