Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect stream properties (TypeError) while trying to decompress #67

Open
remyroy opened this issue Jun 2, 2019 · 1 comment
Open

Comments

@remyroy
Copy link

remyroy commented Jun 2, 2019

Hi,

I'm having an issue trying to decompress the following archive using pylzma.

This is on Windows 10 with pylzma 0.5.0.

Towards the end of the archive, I'm getting a TypeError exception in decompressor.decompress.

Traceback:

Traceback:
  File "C:\Users\Rémy Roy\Projects\CDDA-Game-Launcher\cddagl\ui.py", line 4966, in timeout
    f.write(extracting_element.read())
  File "C:\Users\RMYROY~1\VIRTUA~1\CDDA-G~3\lib\site-packages\py7zlib.py", line 632, in read
    data = getattr(self, decoder)(coder, data, level, num_coders)
  File "C:\Users\RMYROY~1\VIRTUA~1\CDDA-G~3\lib\site-packages\py7zlib.py", line 702, in _read_lzma
    return self._read_from_decompressor(coder, dec, input, level, num_coders, with_cache=True)
  File "C:\Users\RMYROY~1\VIRTUA~1\CDDA-G~3\lib\site-packages\py7zlib.py", line 686, in _read_from_decompressor
    data = decompressor.decompress(input, self._start+size)

This is the relevant code that does the decompression:

from py7zlib import Archive7z

class Dummy():

    def decompress():
        self.extracting_zipfile = open(self.downloaded_file, 'rb')
        self.extracting_archive = Archive7z(self.extracting_zipfile)
        self.extracting_infolist = self.extracting_archive.getmembers()

        self.extracting_index = 0

        while (self.extracting_index < len(self.extracting_infolist)):

            extracting_element = self.extracting_infolist[
                self.extracting_index]
            destination = os.path.join(self.extract_dir,
                *extracting_element.filename.split('/'))
            dest_dir = os.path.dirname(destination)
            if not os.path.isdir(dest_dir):
                os.makedirs(dest_dir)
            with open(destination, 'wb') as f:
                f.write(extracting_element.read())
            self.extracting_index += 1

The real code that does the decompression can be found here.

Here is more information about that archive:

file-info

This seems related to #56 and maybe to what @victor3rc was talking in #32.

@remyroy
Copy link
Author

remyroy commented Jun 5, 2019

Unfortunately, the faulty archive link died, but here is a copy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant