-
-
Notifications
You must be signed in to change notification settings - Fork 74
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
EOFError when reading a second file in an archive #240
Comments
Once SevelZipFIle.read() called, all the file are processed and file pointer goes to EOF. caution: when you handle 1GB archive and read(), reset() and read(), you read 2GB from disk. i.e.
|
Thank you for this advice and timed passed for this 7z module.
My application provides an interface to access to zip files content without unzipping all the content. The list of files is dynamically defined and archives are quite big. In the standard zipfile module, a single file could be opened with archive.open(‘file_name’, ‘r’) function.
Is-it not possible to read only some files on the archive, without reading all of them ? What’s the difference between read() and readall() if read() reads also all the files ?
|
7-Zip use "solid compression" . https://en.wikipedia.org/wiki/Solid_compression py7zr take a design that readall() and read(name-spec) read all chunks, and return all of archive files or parts of files. By contrast, the ZIP format is not solid because it stores separately compressed files. |
That’s clear. A single file couldn’t be access without reading all the other files. For example:
|
|
Question is answered. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the bug
The first file opened with the first call to zip_file.read() is correctly open but the second returns an EOFError
To Reproduce
The first file content is printed:
b'#!/usr/bin/env python\n'
b'\n'
b'import sys\n'
b'\n'
b'from py7zr import main\n'
b"if name == 'main':\n"
b' sys.exit(main())\n'
b'\n'
***But the second returns an EOFError Exception ***
Traceback (most recent call last):
File "\Continuum\miniconda3\envs\test7zip\lib\site-packages\py7zr\py7zr.py", line 735, in _extract
self.worker.extract(self.fp, parallel=(not self.password_protected and not self._filePassed))
File "\Continuum\miniconda3\envs\test7zip\lib\site-packages\py7zr\py7zr.py", line 954, in extract
self.extract_single(fp, self.files, self.src_start, src_end, q)
File "\Continuum\miniconda3\envs\test7zip\lib\site-packages\py7zr\py7zr.py", line 1024, in extract_single
exc_q.put(exc_tuple)
File "\Continuum\miniconda3\envs\test7zip\lib\site-packages\py7zr\py7zr.py", line 1015, in extract_single
if f.crc32 is not None and crc32 != f.crc32:
File "\Continuum\miniconda3\envs\test7zip\lib\site-packages\py7zr\py7zr.py", line 1058, in decompress
tmp = decompressor.decompress(inp, max_length)
File "\Continuum\miniconda3\envs\test7zip\lib\site-packages\py7zr\compressor.py", line 763, in decompress
folder_data = self.cchain.decompress(data, max_length=max_length)
File "\Continuum\miniconda3\envs\test7zip\lib\site-packages\py7zr\compressor.py", line 687, in decompress
tmp = self._decompress(data, max_length)
File "\Continuum\miniconda3\envs\test7zip\lib\site-packages\py7zr\compressor.py", line 668, in _decompress
raise EOFError
EOFError
Expected behavior
A clear and concise description of what you expected to happen.
Environment (please complete the following information):
Test data(please attach in the report):
The 7zip file test comes from git repo: py7zr-0.9.5\tests\data\lzma2_1.7z
Additional context
The text was updated successfully, but these errors were encountered: