Using Python TarFile.extractall to decompress a tarball

suggest change
file_untar = 'filename.tar.gz'
untar = tarfile.TarFile(file_untar)
untar.extractall()
untar.close()

tarfile is not imported in this fragment, and filename.tar.gz is not in this book. tarfile.TarFile reads an uncompressed tar archive. Opening a gzip-compressed tarball that way raises tarfile.ReadError. Use tarfile.open(file_untar, 'r:gz') for this filename.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents