Debugging in Py

Tim Chase python.list at
Wed Mar 25 16:52:56 CET 2009

> I'm just wondering if you all have any resources on Debugging that you
> all would "recommend." Due to the fact I'm doing some debugging as a
> beginner and this has the best of me, and I'm looking at trying to
> learn more about what and how to debug within Py using print, and
> etc...

For most of what I do, simply dropping a "print" line suffices. 
For more complex stuff where I want to do a bit of on-the-fly 
inspection, I'll often just add the line

   import pdb; pdb.set_trace()

to my code and it will halt at a debugger prompt.  You can then 
use the batteries-included "pdb" debugger to inspect your 
program's internal state.

You can read up on it at

I use it mostly to dump variable contents and step into/over 
lines of code (there are much deeper abilities that I hardly 


More information about the Python-list mailing list