pretty-errors
Prettifies Python exception output to make it legible.
What it is and what it does
pretty-errors intercepts Python exceptions and reformats their tracebacks with syntax highlighting, context code snippets, and configurable layout options. It works by installing a custom sys.excepthook or by scraping stderr output when frameworks override the default exception handler. The package is designed to be installed globally via the Python startup procedure (python -m pretty_errors) so it activates for all scripts, including those that raise SyntaxError before import statements can run.
You can also import it directly in individual projects and configure its output—controlling separator characters, line numbers, local variable display, code context lines, and color schemes. It respects environment variables to disable itself when redirecting to files or in non-interactive terminals, and supports path-based whitelisting and blacklisting to hide or highlight specific stack frames.
Use it for:
- Interactive debugging: Run scripts in the terminal and see colorized, readable tracebacks with surrounding code context.
- Development workflow: Install globally to automatically format all Python exceptions without modifying project code.
- Framework debugging: Use replace_stderr() to capture and reformat exceptions from frameworks like uvicorn that override the default exception handler.
- Local variable inspection: Enable display_locals to see variable values at the point of failure in the top stack frame.
- CI/CD logs: Disable pretty formatting in non-interactive environments using PYTHON_PRETTY_ERRORS_ISATTY_ONLY to keep logs clean.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Reformats Python exception tracebacks with color, context, and configurable layout to make errors easier to read and debug in the terminal.
Yes, if you spend time debugging Python in the terminal. It's a low-friction install with no security issues and genuinely improves readability of exception output. The dormant maintenance is not a concern for a stable, focused tool that does one thing well. Install globally via python -m pretty_errors for the best experience, or import it in projects that need custom formatting.
Install
pretty-errors on PyPI
pip
pip install pretty-errorsuv
uv add pretty-errorspoetry
poetry add pretty-errorsInstalling pretty-errors
Before you install
Low friction install with a single dependency (colorama). Dormant since late 2021 but stable; last commit was March 2024. No known vulnerabilities.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.
Quickstart
pip install pretty_errors
python -m pretty_errors
Or in code:
import pretty_errors
pretty_errors.configure(display_locals=True)
Requires a terminal capable of color output; Windows users should use PowerShell or cmder rather than cmd.exe. Can fall back to monochrome with pretty_errors.mono().
Verify before relying
- Whether the package works reliably with modern Python versions (3.10+) given its dormant maintenance status since 2021.
- Compatibility with recent web frameworks that override sys.excepthook (e.g., uvicorn, FastAPI) beyond the replace_stderr() workaround mentioned.
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — colorama |
| Maintenance | dormant — 1,724 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 159,216/month — #10,704 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pretty_errors-1.2.25-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
traceriteFormats Python exceptions and tracebacks into…
permissive · top 5,000 on PyPI
colorlogAdds colored output to Python's standard…
permissive · top 1,000 on PyPI
stackprinterReplaces Python's default exception traceback…
permissive · top 15,000 on PyPI
termcolorAdds ANSI color and text formatting (bold,…
permissive · top 1,000 on PyPI
coloredColored provides ANSI/VT100 escape sequences…
permissive · top 5,000 on PyPI
strip-ansiRemoves ANSI escape sequences (color codes,…
unclear · top 15,000 on PyPI
ansiProvides ANSI escape codes for cursor movement…
permissive · top 15,000 on PyPI
ansimarkupAnsimarkup converts XML-like markup tags into…
permissive · top 15,000 on PyPI
terminaltexteffectsRenders animated visual effects for text…
permissive · top 15,000 on PyPI
coloramaColorama makes ANSI escape sequences for…
permissive · top 100 on PyPI