On this page
tarfile.ReadError
Prev: tarfile.OutsideDestinationError | Up: tarfile | Next: tarfile.SpecialFileError
Rel: tarfile.AbsoluteLinkError, tarfile.AbsolutePathError, tarfile.CompressionError, tarfile.data_filter
Ref: docs.python.org โ tarfile.ReadError
Tags: #public #python3 #stdlib #tarfile
Import
import tarfile
from tarfile import ReadError
Signature & Overview
tarfile.ReadError(...)
Exception for unreadable tar archives.
Methods & Attributes
ReadError.add_note(self, note, /)โ Add a note to the exceptionReadError.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import io
import tarfile
try:
with tarfile.open(fileobj=io.BytesIO(b"not a tar"), mode="r:*"):
pass
except tarfile.ReadError:
assert True
Gotchas
- Raised when an archive cannot be opened or is truncated/corrupt.
REPL Inspect
from tarfile import ReadError
help(ReadError)
Linked from
Related notes
- tuts/python3/stdlib_module/tarfile/OutsideDestinationError Linked here; links to this page; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/SpecialFileError Linked here; links to this page; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/AbsoluteLinkError Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/AbsolutePathError Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/CompressionError Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/data_filter Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/TarFile Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/tarfile/ExtractError shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/FilterError shared tags: #stdlib, #tarfile