New submission from BoppreH: I may be misunderstanding file modes or the `zipfile` library, but
from zipfile import ZipFile ZipFile(open('a.zip', 'ab'), 'a').writestr('f.txt', 'z') unexpectedly creates an invalid zip file. 7zip is able to open and show the file list, but files inside look empty, and Windows simply says it's invalid. Changing the file mode from `ab` to `wb+` fixes the problem, but truncates the file, and `rb+` doesn't create the file. Calling `close` on both the `open` and `ZipFile` doesn't help either. Using `ZipFile(...).open` instead of `writestr` has the same problem. I could only reproduce this on [Windows 10, Python 3.6.1, 64 bit]. The zip file was proper on [Windows 10, Python 3.3.5, 32 bit], [Windows 10 Bash, Python 3.4.3, 64 bit], and [FreeBSD, Python 3.5.3, 64 bit]. This is my first bug report, so forgive me if I made any mistakes. ---------- components: Library (Lib), Windows messages: 292616 nosy: BoppreH, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: ZipFile from 'a'ppend-mode file generates invalid zip type: behavior versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30213> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com