[issue8978] "tarfile.ReadError: file could not be opened successfully" if compiled without zlib

Anthony Sottile report at bugs.python.org
Mon Mar 15 20:05:55 EDT 2021


Anthony Sottile <asottile at umich.edu> added the comment:

I took a stab at improving the error message (see the linked PR)

$ ./python -c 'import tarfile; tarfile.open("Lib/test/testtar.tar.xz")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/asottile/workspace/cpython/Lib/tarfile.py", line 1620, in open
    raise ReadError(f"file could not be opened successfully:\n{error_msgs}")
tarfile.ReadError: file could not be opened successfully:
- method gz: ReadError('not a gzip file')
- method bz2: CompressionError('bz2 module is not available')
- method xz: CompressionError('lzma module is not available')
- method tar: ReadError('truncated header')

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue8978>
_______________________________________


More information about the Python-bugs-list mailing list