python execution path

Peter Hansen peter at engcorp.com
Tue Jan 18 01:40:05 CET 2005


Dustin Lee wrote:
> I'm wondering if there is a way to get python to show each line as it
> is executed, sort of like sh -x does for shell programs.  Seems like
> this would be a nice debugging aid.

The best approach, if it's really intended to be a debugging
aid, might be to learn about "pdb", starting perhaps with the
following line inserted shortly above where you think your
bug might be:

import pdb; pdb.set_trace()

(run the code, wait for the prompt, type "?" for help, then
read the docs ;-)  )

-Peter



More information about the Python-list mailing list