我正在使用一个代码来解压缩来自blob存储的归档文件,这个代码已经对另一个300mb的归档文件起作用了,但是在尝试解压缩另一个大于300MB的归档文件时,我得到了这个错误:
"NotImplementedError: That compression method is not supported"
The last lines of error console show this :
/usr/local/lib/python3.8/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
/usr/local/lib/python3.8/zipfile.py in _check_compression(compression)
698 "Compression requires the (missing) lzma module")
699 else:
--> 700 raise NotImplementedError("That compression method is not supported")我使用下面的代码来实现:
# mother folder
files = dbutils.fs.ls(dl_path)
for fi in sorted(files, reverse=True):
zip_files = zipfile.ZipFile(f'/dbfs{dl_path}{fi.name}')
print(zip_files.namelist())
for f in zip_files.namelist():
zip_files.extract(f, str(extract_path).replace('dbfs:', '/dbfs'))我不知道为什么在一个档案馆里这个可以用,而另一个不能。我猜可能是大小问题吧?所以我在考虑做一个尝试:第一个代码,除了第二个代码?艾克,有人有小费吗?
发布于 2021-08-20 19:27:56
在zip文件中允许使用许多压缩方法。该zip文件似乎使用了Python库不支持的压缩方法。
对未能列出内容的zip文件使用命令行解压缩。执行unzip -lv file.zip。它将列出使用的压缩方法。
https://stackoverflow.com/questions/68863705
复制相似问题