[Tutor] print stack traces not caused by errors

Alan Gauld alan.gauld at btinternet.com
Wed Jan 5 00:59:24 CET 2011


"Alex Hall" <mehgcap at gmail.com> wrote

> expected at all. I tried the pdb module, but I am running a wx 
> program
> so it is not helping. I tried:
> python -m pdb c:\prog\solitaire\game.py

The key to using any debugger in a GUI environment is to set break
points on the event handlers of interest. Then when the event fires
the debugger will stop your code at the start of the event handler
and you can examine the stack, variables etc and step through
the code.

Single line stepping is tiresome so usually you are better off
setting another break point within the function (just before or within
a loop maybe? Or after reading a line from a file...). A watch point
is even better but sadly I don't think pdb supports those. But
the debugger in Eclipse and winPDB(?) do I think.

And of course print statements work too within the console
window.

HTH,

Alan G. 




More information about the Tutor mailing list