[Tutor] way to see code execution in real-time?
zstumgoren at gmail.com
Fri Oct 16 19:43:22 CEST 2009
Thanks for the recommendations -- I usually do use pdb to step through
chunks of code, but always by setting a breakpoint. And then I have to
"manually" print out the variables to see what's going on in the code.
Is there a way to wrestle pdb into spitting out the code being
executed, as it executes (without having to manually do so myself)?
Perhaps a profiler will get me most of the way to where. The time
element isn't as necessary for me as understanding what gets fired,
how many times, etc. It would be great to see the order of execution,
so I'll try CodeInvestigator to see if that will do the trick.
Meantime, thanks as always!
On Fri, Oct 16, 2009 at 1:29 PM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> "Serdar Tumgoren" <zstumgoren at gmail.com> wrote
>> I was wondering -- is there a way to "watch" a program execute by
>> piping a report of its actions to standard output or to a file?
> There are tools for doing that - Look! - is one I know that works for C++
> and Java but I don;t know iof any freware ones or that work for Python.
>> Basically, I'd like to see the order that functions/methods are
>> executing as they happen, along with how long each one takes.
> You can run it in any debugger and use the step into/step over buttons to
> walk through the code. But it is extremely tiresome!
> One of my colleagues once spent nearly two weeks stepping though some
> undocumented code we had been given to find out how it works. He was not a
> happy man.
> If you do go that way I strongly recommend using a graphical front end like
> IDLE/Pythonwin/Eclipse(PyDev) etc.
>> Is this something cProfile would do, or is there another tool built
>> for that purpose?
> Never come across cProfile but profiling tools generally just give you a
> report at the ed of what has been executed.
> Alan Gauld
> Author of the Learn to Program web site
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor