I have the following code
import tarfile
for archive in archives:
tar = tarfile.open(archive, "r:gz")
tar.extractall()
tar.close()
where archives
is list of files with .tar.gz
extension. Although it crashes while trying to open tar.gz file with tarfile.CompressionError: gzip module is not available
. It is interesting, because module gzip.py is located in /usr/lib/python2.6
.
When I try command file <name_of_archive>
it returns: <name_of_archive>: gzip compressed data, from Unix.
How can I solve this?
Thanks