Debugging in Python (2009)
pythonconquerstheuniverse.wordpress.com
pythonconquerstheuniverse.wordpress.com
At my current job I write C++ and I use a debugger practically every day. My previous job was all Python and I reached for pdb maybe 3 times in 4 years.
I love using pdb when debugging django test cases find it faster than using prints all over the place.
The debugger runs as a full screen GUI app, which you attach via sockets to a running process, so you can easily debug stuff like FCGIs on other machines, etc.
import pydevd; pydevd.settrace('192.168.xxx.xxx')
Same kind of thing, but with full debug UI, and you can debug remote processes, eg behind apache!
* Wonder how you ever did without it
* Wonder why on earth it's not a standard part of Python
* Free your code of crappy conditional debug prints forever
* Take ipdb to bed and cuddle it at night
Just:
import ipdb
Then where you'd like to start debugging: ipdb.set_trace()
Type 'help' for help.