Issue1698398
Created on 2007-04-11 12:58 by szabihernyo, last changed 2008-01-14 23:05 by rhettinger.
| Messages | |||
|---|---|---|---|
| msg31762 (view) | Author: Szabolcs Berecz (szabihernyo) | Date: 2007-04-11 12:58 | |
In zipfile.py:448
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time
should be changed to
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
checked with python2.[45] on windows and linux
>>> from zipfile import ZipFile
>>> from StringIO import StringIO
>>> s = StringIO()
>>> zf = ZipFile(s, 'w')
>>> zf.writestr('file.ext', '123')
>>> zf.printdir()
File Name Modified Size
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/zipfile.py", line 448, in printdir
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time
TypeError: int argument required
>>> zf.filelist[0].date_time
(2007, 4, 11, 13, 38, 58, 2, 101, 1)
>>>
|
|||
| msg31763 (view) | Author: Alan McIntyre (alanmcintyre) | Date: 2007-04-11 13:34 | |
The same problem appears to be present in 2.6 as well. The date_time attribute of ZipInfo is a time.struct_time in 2.4 and 2.6 (I don't have 2.5 available to check at the moment), not a tuple. I'm assuming this could be fixed by changing that line to: date = "%d-%02d-%02d %02d:%02d:%02d" % tuple(zinfo.date_time)[:6] At the moment I can't connect to the svn server; when I can I'll submit a patch for the trunk and 2.5. |
|||
| msg31764 (view) | Author: Alan McIntyre (alanmcintyre) | Date: 2007-04-12 03:28 | |
Patches to fix this have been posted for 2.5 (#1698915) and 2.6 (#1698917) |
|||
| msg59931 (view) | Author: Raymond Hettinger (rhettinger) | Date: 2008-01-14 23:05 | |
Fixed in revision 59959 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-01-14 23:05:01 | rhettinger | set | status: open -> closed resolution: fixed messages: + msg59931 |
| 2007-04-11 12:58:45 | szabihernyo | create | |