pudb debugger
Date: January 9th 2016
Last updated: January 10th 2016
pudb is a great GUI debugger. It uses commands from pdb like u (up) and d (down) to move around a call stack and n to process a single step. A cool feature of pudb debugger is the prompt on the last line of your code to restart debugging.
Quick start commands:
command | reference |
---|---|
ctrl-p | Preferences. Change colour themes etc. |
ctrl-l | Redraws screen. Useful after changing preferences. |
? | Help screen. |
! | Go to the command line. |
ctrl-x | Exit from command line. |
# Run inline using set_trace() (see the figure)
# vowels.py is exactly the same script used for pdb debugger.
python vowels.py
# Run at command line
pudb vowels.py
Make sure to have appropriate privileges if running the second option (i.e. sudo pudb vowels.py). pudb will exit to a post-mortem screen if you don't. Also, use s to step into functions rather than using n.
Useful resources:
- https://pypi.python.org/pypi/pudb
- https://asmeurersympy.wordpress.com/2010/06/04/pudb-a-better-python-debugger/
EDIT: On further testing I noted several points. First, if you try to run this inside a python notebook you won't get very far, it will break. Second, if you include a raw_input command (input for py3x), the GUI will temporarily disappear so you can enter a string in the terminal.