whatisgithub

What is better-exceptions?

qix-/better-exceptions — explained in plain English

Analysis updated 2026-06-26

4,729PythonAudience · developerComplexity · 1/5Setup · easy

In one sentence

A Python package that replaces the default crash output with colorized stack traces showing the actual values of variables at the moment your code crashed, making bugs much easier to spot.

Mindmap

mindmap
  root((better-exceptions))
    What it does
      Colorized tracebacks
      Show variable values
      Readable crash output
    Setup
      pip install
      Set env variable
      No code changes
    Integrations
      Django middleware
      Python test runner
      Interactive shell
    Caution
      Disable in production
      Sensitive data risk
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Immediately see which variable held the bad value that caused a crash, without adding print statements.

USE CASE 2

Enable better error output globally for a Django web app via a middleware component.

USE CASE 3

Use colored, readable tracebacks in your test suite to make failing tests easier to diagnose.

What is it built with?

Python

How does it compare?

qix-/better-exceptionsopen-mmlab/mmocrcookiecutter-flask/cookiecutter-flask
Stars4,7294,7304,727
LanguagePythonPythonPython
Setup difficultyeasyhardeasy
Complexity1/54/52/5
Audiencedeveloperresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Disable before production deployment to avoid leaking sensitive variable values in logs or error pages.

So what is it?

Better-exceptions is a Python package that makes error messages easier to read when something goes wrong in your code. By default, Python prints a stack trace when a crash happens, which shows you the sequence of function calls that led to the error, but it can be hard to parse. Better-exceptions reformats that output with colors and adds the actual values of variables at the moment the crash occurred, so you can see what data caused the problem without adding extra print statements. Setting it up is minimal. You install it through pip, Python's standard package manager, and then set a single environment variable to turn it on. After that, it activates automatically for any Python script you run, with no code changes needed. A security note in the README advises turning it off in production environments because printing variable values in logs can expose sensitive information like passwords or user data. The package works in several contexts beyond basic script execution. It can be used in the interactive Python shell, in Django web applications through a middleware component, and in Python's built-in testing framework. Each integration has slightly different setup instructions described in the README. If the improved output does not appear after setup, the README walks through common causes: the environment variable not being set permanently, another package overriding Python's error handler, or a supporting file getting accidentally deleted during updates.

Copy-paste prompts

Prompt 1
I installed better-exceptions and set the environment variable, but I'm still seeing plain Python tracebacks. What could be overriding it?
Prompt 2
How do I enable better-exceptions in a Django project so I see colorized tracebacks with variable values in development?
Prompt 3
Show me how to activate better-exceptions for a Python script with a single environment variable, without changing any code.
Prompt 4
I'm using better-exceptions in development. What should I do before deploying to production so variable values don't appear in logs?

Frequently asked questions

What is better-exceptions?

A Python package that replaces the default crash output with colorized stack traces showing the actual values of variables at the moment your code crashed, making bugs much easier to spot.

What language is better-exceptions written in?

Mainly Python. The stack also includes Python.

How hard is better-exceptions to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is better-exceptions for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.