Serhiy Storchaka added the comment:
> Would it help to remove the offending bytes and then feed the bytes-object to
> ZipFile?
Yes, it will.
import zipfile, struct, io
with open('not_working.zip', 'rb') as f:
data = f.read()
i = data.rindex(b'PK\5\6') + 22
i += struct.unpack('<H', data[i-2: i])[0]
if data[i:].strip(b'\0') == b'':
data = data[:i]
zf = zipfile.ZipFile(io.BytesIO(data))
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24621>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com