Andrei Kulakov <andrei....@gmail.com> added the comment:
Liu: apologies for the confusion, I missed that when coming back to the thread for the 2nd time. I took a look at the code and one potential issue I see is that you are opening the file in 'w' mode if stat size is 0 (or if file isn't valid), and in 'a' mode otherwise. It's better to just use the 'a' mode as then the file will be created if it doesn't exist. This may lead to file being opened in 'w' mode after some files already were meant to be written, - due to buffering. A second issue is that you're closing and reopening the archive for each file written. I'm not sure if you had a reason for that but it's better to open the archive and write all of the files if you have them ready. It's hard to say exactly what lead to this incomplete archive without a reproducible way to create it. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41102> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com