[Tutor] print stack traces not caused by errors

Corey Richardson kb1pkl at aim.com
Wed Jan 5 01:06:44 CET 2011


On 01/04/2011 06:59 PM, Alan Gauld wrote:
> 
> "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. 
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

I've done almost all my debugging via print statements at crucial
points. It's a good way to go, IMO.

~Corey Richardson


More information about the Tutor mailing list