[issue12198] zipfile.py:1047: DeprecationWarning: 'H' format requires 0 <= number <= 65535

Petri Lehtinen report at bugs.python.org
Mon May 30 11:02:33 CEST 2011


Petri Lehtinen <petri at digip.org> added the comment:

On 2.7, your example raises an error:

Traceback (most recent call last):
  File "a.py", line 7, in <module>
    z.write("a", "a")
  File "/home/petri/tmp/cpython/cpython/Lib/zipfile.py", line 1071, in write
    self.fp.write(zinfo.FileHeader())
  File "/home/petri/tmp/cpython/cpython/Lib/zipfile.py", line 348, in FileHeader
    len(filename), len(extra))
struct.error: ushort format requires 0 <= number <= USHRT_MAX

I doubt this can be fixed in 2.6 anymore, as it's in security fix only -mode.

What comes to the error on 2.7, it could be better. If zip files simply don't support dates before 1980, an error describing this could be raised. Another possibility would be to clamp too old dates to 1980.

----------
nosy: +petri.lehtinen

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12198>
_______________________________________


More information about the Python-bugs-list mailing list