我的代码如下(从这里:Example of how to use PyLZMA)
import py7zlib
...
#filename.__class__ is <class 'django.core.files.uploadedfile.InMemoryUploadedFile'>
archive = py7zlib.Archive7z(filename)
data = archive.getmember(archive.getnames()[0]).read()我得到的错误是:
*** ValueError: data error during decompression我正在测试的归档文件是从制造商网站下载的7z压缩格式的驱动程序。我还使用7zip创建了一个7z归档文件进行测试,但我得到了相同的结果。
发布于 2017-01-02 19:48:56
我建议您先打开文件,然后再使用'py7zlib'包。我已经使用此方法成功地读取了文件。
content=open(filename,"rb")
archive = py7zlib.Archive7z(content)
data = archive.getmember(archive.getnames()[0]).read()https://stackoverflow.com/questions/20218922
复制相似问题