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

Lars Gustäbel report at bugs.python.org
Sat Jun 12 12:33:12 CEST 2010


Lars Gustäbel <lars at gustaebel.de> added the comment:

If you pass an explicit mode, the error message is more or less what you want:

>>> tarfile.open("uga.tgz", mode="r:gz")
[...]
tarfile.CompressionError: gzip module is not available

The way mode="r" detects which compression format is used is to open the file with each open method (i.e. taropen, gzopen, bz2open) until one of them succeeds. If none of them matches it is impossible to say what the reason was.

As this would require more than just a simple one-line change, 2.7 is out of the question. But I see what I can do for 3.2.

----------
versions:  -Python 2.7

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


More information about the Python-bugs-list mailing list