PrettyErrors is a Python library designed to make Python exception output more legible and user-friendly. It provides color coding, simplifies tracebacks, and categorizes errors, making it easier for developers to understand what went wrong and how to fix it. The current version is 1.2.25. Its release cadence is irregular, with updates typically driven by new features or bug fixes rather than a strict schedule.
pip install pretty_errorsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and optionally configure `pretty_errors` to format exception output. It then triggers a `ZeroDivisionError` to show the prettified traceback. For universal activation across all Python runs (including `SyntaxError`), run `python -m pretty_errors` in your terminal once after installation.
Use a terminal emulator that supports ANSI color codes. If a monochrome terminal is necessary, call `pretty_errors.mono()` after importing `pretty_errors` to optimize output for it, or configure colors manually to be empty strings.
For universal formatting, including `SyntaxError`s, activate `pretty-errors` at Python startup by running `python -m pretty_errors` in your terminal once. This sets up your Python environment to include `pretty-errors` automatically.
If conflicts arise, consider conditionally activating `pretty_errors` using `pretty_errors.activate()` within your code, or set the `PYTHON_PRETTY_ERRORS_ISATTY_ONLY` environment variable to '1' to only activate `pretty_errors` in interactive terminal sessions.
Ensure you are using a color-capable terminal (e.g., PowerShell, Cmder, VS Code terminal). If running in a monochrome environment, call `pretty_errors.mono()` after importing `pretty_errors` or configure colors manually to be empty strings.
Activate `pretty-errors` universally by running `python -m pretty_errors` in your terminal once. This configures Python's startup procedure to include `pretty-errors`, allowing it to handle `SyntaxError` exceptions before your script even runs.
Ensure `import pretty_errors` is one of the *very first* imports in your main script. Alternatively, for universal activation across all Python invocations, run `python -m pretty_errors` once to configure your Python environment.
No dependency data recorded yet.