Crashtest
raw JSON → 0.4.1 verified Tue May 12 auth: no python install: stale quickstart: stale
Crashtest is a Python library designed to simplify the handling and inspection of exceptions, providing tools to manage Python errors with ease. It is currently at version 0.4.1 and has a moderate release cadence, with recent updates focused on stability and type hinting.
pip install crashtest Common errors
error ModuleNotFoundError: No module named 'crashtest' ↓
cause The 'crashtest' library is not installed in your Python environment or is not accessible on the Python path.
fix
Install the library using pip:
pip install crashtest error TypeError: Crash() missing 1 required positional argument: 'exception_or_frame' ↓
cause The `crashtest.Crash` class was instantiated without providing the mandatory `exception_or_frame` argument, which expects an exception instance or a frame object.
fix
When creating a
crashtest.Crash object, provide an exception instance (e.g., caught in an except block) or a frame object: crashtest.Crash(e) or crashtest.Crash(sys.exc_info()[2].tb_frame). error AttributeError: 'Crash' object has no attribute 'some_invalid_attribute' ↓
cause You are attempting to access an attribute or method on a `crashtest.Crash` instance that does not exist or is misspelled.
fix
Consult the
crashtest documentation for the correct attributes and methods available on the Crash object, or use dir(crash_instance) to inspect its members. Warnings
breaking Crashtest versions 0.4.0 and newer require Python 3.7 or higher. Users on Python 3.6 or older will encounter compatibility issues when upgrading. ↓
fix Upgrade your Python environment to 3.7 or newer, or pin `crashtest` to a version older than 0.4.0 (e.g., `<0.4.0`).
gotcha Version 0.4.0 introduced stricter type hinting. A 'too narrow type' in the `Inspector` class was fixed in 0.4.1, suggesting that `0.4.0` might have introduced new type-related errors if existing code passed unexpected types. ↓
fix Update to `crashtest` 0.4.1 or later to benefit from the corrected type definitions and avoid potential type-related runtime errors.
gotcha Prior to version 0.4.0, `crashtest` could encounter decoding errors when opening files due to the lack of explicit 'utf-8' encoding. ↓
fix Upgrade to `crashtest` 0.4.0 or later to ensure proper handling of file encodings.
gotcha In versions prior to 0.3.1, there was an error when attempting to retrieve the line of a frame if it had no context. ↓
fix Upgrade to `crashtest` 0.3.1 or later to fix issues with context-less frame line retrieval.
breaking The `Inspector` class was moved from being directly available under the `crashtest` package to `crashtest.inspector` in version 0.4.0. Attempts to import it directly via `from crashtest import Inspector` will result in an `ImportError` in versions 0.4.0 and newer. ↓
fix Update import statements from `from crashtest import Inspector` to `from crashtest.inspector import Inspector` to correctly import the class.
Install compatibility stale last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) - - - -
3.10 slim (glibc) - - - -
3.11 alpine (musl) - - - -
3.11 slim (glibc) - - - -
3.12 alpine (musl) - - - -
3.12 slim (glibc) - - - -
3.13 alpine (musl) - - - -
3.13 slim (glibc) - - - -
3.9 alpine (musl) - - - -
3.9 slim (glibc) - - - -
Imports
- Inspector
from crashtest import Inspector - ErrorHandler
from crashtest import ErrorHandler
Quickstart stale last tested: 2026-04-23
import sys
from crashtest import Inspector
def might_fail():
a = 1
b = 0
return a / b
try:
might_fail()
except Exception as e:
inspector = Inspector(e)
print(f"Exception type: {inspector.type}")
print(f"Exception message: {inspector.message}")
print("Stack Trace:")
for frame in inspector.frames:
print(f" File: {frame.file}, Line: {frame.lineno}, Function: {frame.name}")
print(f" Code: {frame.line.strip() if frame.line else 'N/A'}")