Christopher Brannon <[EMAIL PROTECTED]> added the comment: What value should the new archive entry's external_attr attribute have? ZipFile.write sets it to the permissions of the file being archived, but writestr is archiving a string, not a file. Setting it to 0600 << 16 seems reasonable.
Stephen's script exposed a second bug in writestr. When passed a name rather than a ZipInfo instance, the new archive member receives a timestamp of 01/01/1980. However, the docs say that the timestamp should correspond to the current date and time. ZipFile.writestr begins with the following code: def writestr(self, zinfo_or_arcname, bytes): """Write a file into the archive. The contents is the string 'bytes'. 'zinfo_or_arcname' is either a ZipInfo instance or the name of the file in the archive.""" if not isinstance(zinfo_or_arcname, ZipInfo): zinfo = ZipInfo(filename=zinfo_or_arcname, date_time=time.localtime(time.time())[:6]) zinfo.compress_type = self.compression The "date_time=" line should read: zinfo.date_time=time.localtime(time.time())[:6]) ---------- nosy: +cbrannon versions: +Python 2.6 _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3394> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com