fancycode / pylzma

Python bindings for the LZMA library
http://www.joachim-bauch.de/projects/pylzma/
GNU Lesser General Public License v2.1
234 stars 72 forks source link

UnsupportedCompressionMethodError #43

Closed ghost closed 6 years ago

ghost commented 7 years ago

I am using osx (10.11) and python 2.7 and I used keka to compress the files into an archive. The default pip version (pylzma-0.4.8) gives the error

invalid type '\x19'

This is fixed in the version from github, I can read the filenames and sizes! ...but reading the data always results into an exception with

UnsupportedCompressionMethodError: '!'

I saw the warning about multithreading, so my questions are: Are files compressed with keka, (i also tried betterzip) just not readable due to a missing compression method? Do I have to disable multithreading (how?) as suggested when running setup.py install to get this to work?

My code snippet Code

aaronsims-netapp commented 7 years ago

I have hit the same issue (both the invalid type '\x19' and the UnsupportedCompressionMethodError issue.)

I don't have control over the process that's compressing these files. I'm hoping that someone has found a workaround for this.

mikenye commented 6 years ago

FYI: I tried @Marginal's code (https://github.com/Marginal/pylzma) and still have the issue when opening 7z files created by NetApp's ONTAP operating system (assuming @aaronsims-netapp has the same issue).

  File "/usr/local/lib/python2.7/dist-packages/pylzma-0.4.8_14_gaea5dev-py2.7-linux-x86_64.egg/py7zlib.py", line 612, in read
    raise UnsupportedCompressionMethodError(repr(coder['method']))
py7zlib.UnsupportedCompressionMethodError: '!'

EDIT: the invalid type issue seems to be gone, its just the UnsupportedCompressionMethodError remaining.

mikenye commented 6 years ago

Further info:

libmagic identifies the 7z file I'm having a problem with as: body.7z: 7-zip archive data, version 0.4

version 0.3 and prior have no issue.

mikenye commented 6 years ago

In the ArchiveFile.read(), in the for loop for coder in self._folder.coders:

With both a version 0.3 7z file and a version 0.4 7z file, on first call of the read() function, the coder pointer is: {'numinstreams': 1, 'numoutstreams': 1, 'method': '\\x03\\x01\\x01', 'properties': ']\\x00`\\x00\\x00'}

On second call of the read() function:

This is what's throwing the error.

mikenye commented 6 years ago

Further information.

The file in question extracts without issue using 7-zip and p7zip version 9.20

fancycode commented 6 years ago

Could you please provide a small example file that can be used to reproduce the error?

mikenye commented 6 years ago

Yes, however it might contain confidential information so am I able to send outside of this thread?

fancycode commented 6 years ago

Sure, you should see my email address in my profile. However a small public file would be great, so I could add it as testcase if/when the problem is solved.

mikenye commented 6 years ago

I've sent you the confidential one. I'll try to get you one that can be public. Stay tuned.

mikenye commented 6 years ago

This file has the same issue (was created with Keka for Mac version 1.1.1 (2733).

test-issue-43.7z.zip

Sorry it had to be zipped as GitHub doesn't allow uploading of 7z files.