[New-bugs-announce] [issue4871] zipfile can't decrypt

Glade Diviney report at bugs.python.org
Wed Jan 7 21:26:25 CET 2009

New submission from Glade Diviney <gladed at sybase.com>:

If a password is supplied using zpifile.read(objName, password), a 
TypeError occurs:

  File "C:\Program Files\Python30\lib\zipfile.py", line 420, in __init__
  File "C:\Program Files\Python30\lib\zipfile.py", line 424, in 
    self.key0 = self._crc32(c, self.key0)
  File "C:\Program Files\Python30\lib\zipfile.py", line 413, in _crc32
    return ((crc >> 8) & 0xffffff) ^ self.crctable[(crc ^ ch) & 0xff]
TypeError: unsupported operand type(s) for ^: 'int' and 'str'

This is resolved in zipfile.py by replacing this line in __init__:

components: Library (Lib)
messages: 79368
nosy: gladed
severity: normal
status: open
title: zipfile can't decrypt
type: behavior
versions: Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list