Author alter-bug-tracer
Recipients alter-bug-tracer
Date 2019-05-21.12:26:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558441602.37.0.911226270551.issue36991@roundup.psfhosted.org>
In-reply-to
Content
The following code throws an AttributeError when attempting to extract a malformed archive (attached):

import zipfile
import sys

zf = zipfile.ZipFile(sys.argv[1])
for info in zf.infolist():
  zf.extract(info.filename)

Result:
Traceback (most recent call last):
  File "code.py", line 6, in <module>
    zf.extract(info.filename)
  File "/usr/local/lib/python3.8/zipfile.py", line 1607, in extract
    return self._extract_member(member, path, pwd)
  File "/usr/local/lib/python3.8/zipfile.py", line 1677, in _extract_member
    with self.open(member, pwd=pwd) as source, \
  File "/usr/local/lib/python3.8/zipfile.py", line 1548, in open
    return ZipExtFile(zef_file, mode, zinfo, zd, True)
  File "/usr/local/lib/python3.8/zipfile.py", line 801, in __init__
    self._decompressor = _get_decompressor(self._compress_type)
  File "/usr/local/lib/python3.8/zipfile.py", line 708, in _get_decompressor
    return bz2.BZ2Decompressor()
AttributeError: 'NoneType' object has no attribute 'BZ2Decompressor'
History
Date User Action Args
2019-05-21 12:26:42alter-bug-tracersetrecipients: + alter-bug-tracer
2019-05-21 12:26:42alter-bug-tracersetmessageid: <1558441602.37.0.911226270551.issue36991@roundup.psfhosted.org>
2019-05-21 12:26:42alter-bug-tracerlinkissue36991 messages
2019-05-21 12:26:42alter-bug-tracercreate