Archive for Python

Debugging Python Scripts

Posted in Code, Python, Tutorials with tags , , on December 24, 2008 by Mandar Vaze

Found a great way to debug python scripts interactively using pdb aka Python Debugger. It is similar to gdb used on *nix.
Essentially you import pdb in the beginning of the script, and wherever you need to start debugging, add following statement :
pdb.set_trace()
Now you execute the script from command line, and execution will stop where you have added set_trace() call. You are presented with pdb prompt. There after it is similar to gdb commands.

Continue reading