python execution path

qhfgva at gmail.com qhfgva at gmail.com
Tue Jan 18 00:54:12 EST 2005


Peter Hansen wrote:
> 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

This is more of a what if-ish question I guess.  I use pdb fairly
regularly, I'm just looking to extend my debugging toolkit.  I saw an
article recently about how perl has the sh -x type functionality and I
was curious if anything like that was possible in python.  Not entirely
sure how it would make my life better, but it seems intriguing.




More information about the Python-list mailing list