skppy.exceptions¶
Custom exceptions for skppy.
- OldFormatError
Raised when the ZIP-specific header parser receives a legacy pre-ZIP file. The public
skppy.load()entry point detects that format first and routes supported pre-ZIP files to the CArchive parser.
Example
with open("model.skp", "rb") as stream:
try:
header = parse_header(stream)
except skppy.OldFormatError:
model = skppy.load("model.skp")
- InvalidSkpError
Raised by
skppy.load()when an existing file cannot be decoded as a supported SketchUp model.- InvalidSkmError
Raised by
skppy.load_material()when an existing file cannot be decoded as a supported SketchUp material package.
- exception skppy.exceptions.ComponentCycleError[source]
Bases:
ValueErrorA component definition recursively references its active ancestry.
- exception skppy.exceptions.InvalidSkmError[source]
Bases:
ExceptionAn existing file cannot be decoded as a valid SketchUp material package.
- exception skppy.exceptions.InvalidSkpError[source]
Bases:
ExceptionAn existing file cannot be decoded as a valid supported SKP model.
The public loader translates malformed container and binary-payload failures into this exception while retaining the original exception as
__cause__. Filesystem errors such asFileNotFoundErrorandPermissionErrordeliberately remain standard Python errors.
- exception skppy.exceptions.LoadCancelledError[source]
Bases:
ExceptionA caller cooperatively cancelled an in-progress SKP load.
- exception skppy.exceptions.OldFormatError[source]
Bases:
ExceptionSignal that a file belongs to the legacy pre-ZIP parser.
This exception belongs to the modern ZIP header parser. Normal callers should use
skppy.load(), which detects pre-ZIP CArchive files and dispatches them toskppy.parser_legacybefore this exception is raised.- Parameters:
message (str) – Human-readable error description.
filepath (str or None, optional) – Path to the file that triggered the error.
- filepath
Path to the file that triggered the error, if available.
- Type:
str or None
- message
Human-readable error description.
- Type:
str
Example
with open("old_file.skp", "rb") as stream: try: header = parse_header(stream) except skppy.OldFormatError: model = skppy.load("old_file.skp")
- __init__(message: str, filepath: str | None = None)[source]
Store the message and optional file path for a legacy-format failure.
- Parameters:
message (str) – Human-readable error description.
filepath (str or None, optional) – Path to the legacy file, when available.