Giter Club home page Giter Club logo

Comments (5)

miurahr avatar miurahr commented on August 22, 2024

py7zr intend to support bzip2 compression method for 7zip format.
From your log, py7zr happily decode header information and start decompression.

An error you report is happend in

py7zr/py7zr/compression.py

Lines 327 to 333 in 1eae95a

if read_size == 0:
tmp = decompressor.decompress(b'', max_length)
else:
inp = fp.read(read_size)
tmp = decompressor.decompress(inp, max_length)
if len(tmp) == 0:
raise DecompressionError

This means output data of bzip2 decompressor returns a zero size. I'm not sure a condition when it happened, and I don't have data to reproduce it.

If you can prepare minimum and small test archive to reproduce it, please upload to this report.

from py7zr.

andormarkus avatar andormarkus commented on August 22, 2024

Hi,

Here is the sample file: 10000SalesRecords.zip
I have zipped the 7z archive so I can able to upload here.

How did I created the sample .7z file and tested it:

  1. Downloaded and decompressed sample .csv file http://eforexcel.com/wp/wp-content/uploads/2017/07/10000-Sales-Records.zip

  2. On Win10 using 7-Zip software I compressed the file using BZip2 compression method
    image

  3. Tested the decompression on Fedora 31 and py7zr v0.6a1 release

Used code for testing:

import py7zr

archive = py7zr.SevenZipFile('10000SalesRecords.7z', mode='r')
print(archive.getnames())
print(archive.test())

Results:

['10000SalesRecords.csv']
Traceback (most recent call last):
File "decompress.py", line 7, in
print(archive.test())
File "/home/amarkus/.pyenv/versions/3.7.3/lib/python3.7/site-packages/py7zr/py7zr.py", line 688, in test
return self._test_digests()
File "/home/amarkus/.pyenv/versions/3.7.3/lib/python3.7/site-packages/py7zr/py7zr.py", line 528, in _test_digests
if self._test_unpack_digest():
File "/home/amarkus/.pyenv/versions/3.7.3/lib/python3.7/site-packages/py7zr/py7zr.py", line 520, in _test_unpack_digest
self.worker.extract(self.fp) # TODO: print progress
File "/home/amarkus/.pyenv/versions/3.7.3/lib/python3.7/site-packages/py7zr/compression.py", line 277, in extract
self.src_start + positions[i + 1])
File "/home/amarkus/.pyenv/versions/3.7.3/lib/python3.7/site-packages/py7zr/compression.py", line 307, in extract_single
self.decompress(fp, f.folder, fileish, f.uncompressed[-1], f.compressed, src_end)
File "/home/amarkus/.pyenv/versions/3.7.3/lib/python3.7/site-packages/py7zr/compression.py", line 335, in decompress
raise DecompressionError
py7zr.exceptions.DecompressionError

from py7zr.

miurahr avatar miurahr commented on August 22, 2024

Thank you for sharing test data! I can reproduce a problem, and I'd like to add this data as test case.

from py7zr.

andormarkus avatar andormarkus commented on August 22, 2024

Sure, feel free to add it to the test cases

from py7zr.

miurahr avatar miurahr commented on August 22, 2024

The case is solved and released.

from py7zr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.