Author martin.panter
Recipients Ellison Marks, Jeremy Heiner, martin.panter, serhiy.storchaka, takluyver, xiang.zhang
Date 2017-04-08.01:22:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491614580.14.0.0516060806349.issue30017@psf.upfronthosting.co.za>
In-reply-to
Content
It looks like the zip entry writer object may not expect its “close” method to be called multiple times. Other file objects tend to allow this with no ill effect. Adding Serhiy and Thomas who implemented the writer object in Issue 26039.

The first time it is called will be when the context manager (“with” statement) exits.

The second time will be when the TextIOWrapper is garbage-collected. This is documented behaviour <https://docs.python.org/3.6/library/io.html#io.IOBase.__del__>, but I think it is a design mistake of the IOBase hierarchy; see Issue 19829.

A reasonable workaround would be to call encoder.detach() after you have finished writing the zip entry.
History
Date User Action Args
2017-04-08 01:23:00martin.pantersetrecipients: + martin.panter, takluyver, serhiy.storchaka, xiang.zhang, Ellison Marks, Jeremy Heiner
2017-04-08 01:23:00martin.pantersetmessageid: <1491614580.14.0.0516060806349.issue30017@psf.upfronthosting.co.za>
2017-04-08 01:23:00martin.panterlinkissue30017 messages
2017-04-08 01:22:59martin.pantercreate