Recently read the ZIP compression package in Python. To report a mistake.
Python 2.6.6 (r266:84292, June, 14:18:47) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on Linux2type "help", "copyright", "Credits" or "license" for more information.>>> import zipfile>>> ZipFile. ZipFile (' bla.apk ') Traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/ lib64/python2.6/zipfile.py ", line 696, in __init__ self._getcontents () File"/usr/lib64/python2.6/ zipfile.py ", line 716, in _getcontents self._realgetcontents () File"/usr/lib64/python2.6/zipfile.py ", line 772, in _realgetcontents X._decodeextra () File '/usr/lib64/python2.6/zipfile.py ', line 351, in _decodeextra TP, ln = unpack ('
This should be considered a Python bug, detailed in the http://bugs.python.org/issue14315 here is discussed.There are two solutions.
One is: According to this page discussed, hit a patch. Http://bugs.python.org/file24902/fix_zipfile_extra.patch.
Specifically, enter/usr/lib64/python2.6/zipfile.py this file, near line 351, the while extra: change to while Len (extra) >= 4:
Method Two is to upgrade the Python version.
The problem was found on the Python 2.6.6. This python is a Linux-brought version that may be lower. Upgrading 2.7.3 above, this issue has been resolved in the high version. So it's also a way to upgrade python.
Python ZipFile Error problem