py7zlib

Decompressing 7z archive using py7zlib gives *** ValueError: data error during decompression

佐手、 提交于 2019-12-11 02:39:44
问题 My code is as follows (from here: 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() The error that I get is: *** ValueError: data error during decompression The archive I am testing with is a driver compressed in 7z downloaded from the manufacturer's website. I have also used 7zip to create a 7z archive to test with,

How to read from a text file compressed with 7z?

自作多情 提交于 2019-11-28 10:59:30
I would like to read (in Python 2.7), line by line, from a csv (text) file, which is 7z compressed. I don't want to decompress the entire (large) file, but to stream the lines. I tried pylzma.decompressobj() unsuccessfully. I get a data error. Note that this code doesn't yet read line by line: input_filename = r"testing.csv.7z" with open(input_filename, 'rb') as infile: obj = pylzma.decompressobj() o = open('decompressed.raw', 'wb') obj = pylzma.decompressobj() while True: tmp = infile.read(1) if not tmp: break o.write(obj.decompress(tmp)) o.close() Output: o.write(obj.decompress(tmp))

How to read from a text file compressed with 7z?

做~自己de王妃 提交于 2019-11-27 05:54:18
问题 I would like to read (in Python 2.7), line by line, from a csv (text) file, which is 7z compressed. I don't want to decompress the entire (large) file, but to stream the lines. I tried pylzma.decompressobj() unsuccessfully. I get a data error. Note that this code doesn't yet read line by line: input_filename = r"testing.csv.7z" with open(input_filename, 'rb') as infile: obj = pylzma.decompressobj() o = open('decompressed.raw', 'wb') obj = pylzma.decompressobj() while True: tmp = infile.read(1