Debug python programs
p-abel at t-online.de
Thu Sep 11 21:35:03 CEST 2003
Jeremy Jones <zanesdad at bellsouth.net> wrote in message news:<mailman.1063284197.17837.python-list at python.org>...
> * York (yorklee70 at yahoo.com) wrote:
> > Hi, anybody,
> > Would you please recommend some good softwares/methods for
> > tracking/debugging python codes.
> > Thanks,
> > York
> You've got lots of options.
> 1) Your standard insertion of "print" statements throughout the code. A
> lot of times, this is good enough to get the job done. I typically set an
> instance variable named DEBUG for each class that I create (in __init__,
> set self.DEBUG = 0 or 1). Then I have lots of
> if self.DEBUG:
> print "whatever" #insert debug statements here
> It's not the most elegant thing, but man, has it come in handy when you
> don't need a full-blown debugger. (Segue into number 2)
> 2) Python comes with a pretty good debugger built in. Here are the docs:
> 3) pychecker. I know, I know, I know - it's not a debugger. But if you
> point it at your code, it'll inspect it and can help you uncover some
> mistakes that can bite you in the rear.
> 4) trace.py. Never used it, but it's in the standard distribution now
> under Tools/scripts. (I'm including this line item since you mentioned
> "tracking". I guess this is what you mean?)
> Jeremy Jones
At the moment it is
"Project of the month: Boa Constructor" at
More information about the Python-list