[Tutor] Checking/Debugging tools
Alan Gilfoy
agilfoy at frontiernet.net
Sat May 12 22:43:16 CEST 2007
Quoting Kent Johnson <kent37 at tds.net>:
> Alan Gilfoy wrote:
>> My programs often have long, detailed loops in them, and would like
>> to, as I'm executing the loop, view what part of the loop Python
>> is currently processing.
>>
>> Thus, if my program gets stuck in one part of the loop, I would see that.
>> Thus, if one part of my loop is never triggered, I would see that.
>>
>> I could use, within my loop, print 'I am here, at part X of the
>> loop', but I believe that would be far to clunky to put in every
>> section of my program's loop(s).
>
> I'm not really sure what you expect this view to look like. I don't
> know of any tool that will let you dynamically watch a program as it
> executes. Some alternatives:
>
> - A debugger lets you step through the code and see how it behaves.
> winpdb is a pretty nice GUI-based Python debugger and some Python
> development tools have built-in debuggers.
> http://www.digitalpeers.com/pythondebugger/
I got winpdb downloaded, but when I tried to run the script, it said I
needed wxpython. I tried to go to the wxpytohn website, and it's
evidently down right now.
>
> - If the program is stuck in a loop, pressing control-C will abort the
> loop and give a stack trace showing you where it was.
>
> - The Python profiler will tell you (after the fact) how much time you
> spend in each function. To see what part of a loop the program is in
> you would have to break the loop up into functions.
> http://docs.python.org/lib/profile.html
My loop isn't broken into functions, just a truckload of if statements
>
> - A code coverage tool will tell you (after the fact) which lines of
> the program were executed and which were not. (google python code
> coverage)
>
Running that Google Search, I seem to be running into a lot of what
is, to me, technical gobbeldygook. Can y'all help me choose a good
code-coverage tool, and a good tutorial?
> Kent
Alan
----- End forwarded message -----
More information about the Tutor
mailing list