I am trying to unzip several zip files using a python script. However, an error always occurs at this line of code:
import zipfile
with zipfile.ZipFile(FILE_PATH) as zfile:
zfile.extractall(OUTPUT_FILE_PATH)
The error raised is:
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-7-ead33468a516> in <module>
1 with zipfile.ZipFile(FILE_PATH) as zip_ref:
----> 2 zip_ref.extractall(OUTPUT_FILE_PATH)
~\anaconda3\lib\zipfile.py in extractall(self, path, members, pwd)
1645
1646 for zipinfo in members:
-> 1647 self._extract_member(zipinfo, path, pwd)
1648
1649 @classmethod
~\anaconda3\lib\zipfile.py in _extract_member(self, member, targetpath, pwd)
1698 return targetpath
1699
-> 1700 with self.open(member, pwd=pwd) as source, \
1701 open(targetpath, "wb") as target:
1702 shutil.copyfileobj(source, target)
~\anaconda3\lib\zipfile.py in open(self, name, mode, pwd, force_zip64)
1569 pwd = None
1570
-> 1571 return ZipExtFile(zef_file, mode, zinfo, pwd, True)
1572 except:
1573 zef_file.close()
~\anaconda3\lib\zipfile.py in __init__(self, fileobj, mode, zipinfo, pwd, close_fileobj)
817 self._left = zipinfo.file_size
818
--> 819 self._decompressor = _get_decompressor(self._compress_type)
820
821 self._eof = False
~\anaconda3\lib\zipfile.py in _get_decompressor(compress_type)
718
719 def _get_decompressor(compress_type):
--> 720 _check_compression(compress_type)
721 if compress_type == ZIP_STORED:
722 return None
~\anaconda3\lib\zipfile.py in _check_compression(compression)
698 "Compression requires the (missing) lzma module")
699 else:
--> 700 raise NotImplementedError("That compression method is not supported")
701
702
NotImplementedError: That compression method is not supported
I have also noticed that the code works for zipfile that are smaller in size, while the error message is only raised for larger zipfiles. I am not sure why this is the case when all the zipfiles are being created using the same method.
What can I do to fix this error?