pudb
TLDR
Debug Python script
$ pudb [script.py]
Debug with arguments$ pudb [script.py] [arg1] [arg2]
Start at breakpoint$ python -m pudb [script.py]
Post-mortem debugging$ pudb --post-mortem [script.py]
SYNOPSIS
pudb [options] script [args]
DESCRIPTION
pudb is a full-screen, console-based visual debugger for Python. It provides a TUI with code view, variable inspector, stack trace, and breakpoints.
PARAMETERS
--pre-run command
Run command before script.--post-mortem
Debug after exception.--steal-output
Capture stdout/stderr.-m module
Run module.
EXAMPLES
$ # Debug script
pudb myscript.py
# With arguments
pudb myscript.py --config=test
# Run as module
python -m pudb myscript.py
# Post-mortem on crash
pudb --post-mortem crashing_script.py
pudb myscript.py
# With arguments
pudb myscript.py --config=test
# Run as module
python -m pudb myscript.py
# Post-mortem on crash
pudb --post-mortem crashing_script.py
IN-CODE BREAKPOINT
$ import pudb; pudb.set_trace()
# Or Python 3.7+
breakpoint() # with PYTHONBREAKPOINT=pudb.set_trace
# Or Python 3.7+
breakpoint() # with PYTHONBREAKPOINT=pudb.set_trace
KEY BINDINGS
$ n - Next line
s - Step into
c - Continue
b - Set breakpoint
q - Quit
? - Help
Ctrl+p - Preferences
s - Step into
c - Continue
b - Set breakpoint
q - Quit
? - Help
Ctrl+p - Preferences
CAVEATS
Terminal must support curses. May conflict with some terminal settings. Python-specific.
HISTORY
pudb was created by Andreas Klöckner as a visual alternative to pdb, inspired by Borland's Turbo Debugger.


