2016-06-15 88 views
0

我使用下面的Python代码解压文件Python的解压缩大文件 - NotImplementedError:98

import zipfile 
zfile = zipfile.ZipFile(input_file_path) 
zfile.extractall(output_path) 

然而,当我尝试解压缩更大的文件压缩类型。它会引发以下错误。

NotImplementedError: compression type 98 (ppmd)

我该如何解决这个错误?

谢谢。

+0

http://stackoverflow.com/questions/1690993/zip-file-with-ppmd-compression-programmatically-unzip –

回答

0

Python的zipfile模块不支持PPMD压缩 - 见issue 14366(强调):

I think we should add the ability to register new codecs. Support for PPMd, jpeg and WavPack is unlikely to emerge in the Python in the foreseeable future, but users of third-party libraries (such as PIL), will use the new codecs as needed.

只有两种选择:

  • 使用从Python的外部压缩程序, subprocess模块。 p7zip计划将很好地完成这项工作。

  • 修改Python以向zipfile模块添加PPMd支持。

记住PPMD是一个非常罕见的编解码器来使用,所以大多数程序(包括定期unzip)不支持它。

+0

谢谢@Dietrich Epp,我需要在Unix终端服务器上运行Python代码,所以我可以只使用您建议的第二个解决方案。你知道有哪些资源可以帮助我添加PPMd支持吗? – merimini

+0

@merimini:你在说什么? 'subprocess'在终端上正常工作。 –

+0

我用你的第一个选项,它工作。谢谢。 – merimini