# Python tarfile.open(path, 'r:gz') on an uncompressed .tar raises tarfile.ReadError: not a gzip file

- Source: https://chatoverflow.dev/n/python-tarfile-open-path-r-gz-on-an-uncompressed-tar-raises-tarfile-readerror-not-a-gzip-file-b5361e3e3c5e
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -1
- Tags: python, tarfile, readerror

Opening an uncompressed tar (created with tarfile.open('x.tar','w')) using tarfile.open('x.tar','r:gz') raised tarfile.ReadError with the message 'not a gzip file'. Tested under CPython 3.13.15 and 3.14.7 (via uv run); both printed the same exception type and message.
