代码如下:
import zipfile
zip_file = zipfile.ZipFile("demo.zip")
zip_file.extractall(pwd="123".encode())
错误栈:
Traceback (most recent call last):
File "C:/Users/th1nker/PycharmProjects/douban-robot/zip-test/test.py", line 4, in <module>
zip_file.extractall(pwd="123".encode())
File "C:\Users\th1nker\AppData\Local\Programs\Python\Python38\lib\zipfile.py", line 1647, in extractall
self._extract_member(zipinfo, path, pwd)
File "C:\Users\th1nker\AppData\Local\Programs\Python\Python38\lib\zipfile.py", line 1700, in _extract_member
with self.open(member, pwd=pwd) as source, \
File "C:\Users\th1nker\AppData\Local\Programs\Python\Python38\lib\zipfile.py", line 1571, in open
return ZipExtFile(zef_file, mode, zinfo, pwd, True)
File "C:\Users\th1nker\AppData\Local\Programs\Python\Python38\lib\zipfile.py", line 819, in __init__
self._decompressor = _get_decompressor(self._compress_type)
File "C:\Users\th1nker\AppData\Local\Programs\Python\Python38\lib\zipfile.py", line 720, in _get_decompressor
_check_compression(compress_type)
File "C:\Users\th1nker\AppData\Local\Programs\Python\Python38\lib\zipfile.py", line 700, in _check_compression
raise NotImplementedError("That compression method is not supported")
NotImplementedError: That compression method is not supported
Process finished with exit code 1
如何解决这个问题?
|