Tracing the execution of scripts?

R. Bernstein rocky at panix.com
Fri Oct 27 05:31:18 EDT 2006


pydb (http://bashdb.sf.net/pydb) has a both the ability to trace lines
as they are executed as well as an --output option to have this sent
to a file rather than stdout. If your program has threads it would be
good to use the --threading option. (The best threading support is if
your program uses the threading module for threads rather than the
lower-level thread module.)

A demo of the debugger including showing line tracing and output to a file is
here:
  http://showmedo.com/videos/video?name=pythonBernsteinPydbIntro&fromSeriesID=28


"Michael B. Trausch" <"mike$#at^&nospam!%trauschus"> writes:

> Alright, I seem to be at a loss for what I am looking for, and I am not
> even really all that sure if it is possible or not.  I found the 'pdb'
> debugger, but I was wondering if there was something that would trace or
> log the order of line execution for a multi-module Python program.  I am
> having a little bit of a problem tracking down a problem that I
> mentioned earlier
> (http://groups.google.com/group/comp.lang.python/msg/9c759fc888b365be),
> and I am hoping that maybe seeing how the statements are executed will
> shed some light on the entire thing for me.
> 
> The debugger isn't working, though, because I have a timer set up to
> fire off every 20ms to check for incoming network traffic from the
> server, and that timer firing off makes stepping through with the
> debugger seemingly impossible to get any useful data.
> 
> Basically, is there something that will log every line of Python code
> executed, in its order of execution, to a text file so that I can see
> what is (or isn't) happening that I am expecting?  I know that the
> server is sending and receiving properly, because I can connect to it
> with a regular telnet client and it works -- but at the same time,
> everything I can think of to check my program's functionality checks out
> just fine (e.g., it reports that it is successfully sending what I am
> typing to the server, and it says that the server is not sending
> anything back to be read from the socket).
> 
> If it makes any difference, I am using wxWidgets' Python bindings for
> the UI code (and the timer), and using Python's socket library for the
> network stuff.
> 
> 	-- Mike



More information about the Python-list mailing list