Trouble using sys.settrace

tleeuwenburg at gmail.com tleeuwenburg at gmail.com
Thu Aug 30 15:34:16 EDT 2007


On Aug 31, 5:31 am, "tleeuwenb... at gmail.com" <tleeuwenb... at gmail.com>
wrote:
> The code below produces no output. I would expect to see:
>
> tracing...
> tracing...
> tracing...
> tracing...
> tracing...
>
> I was wondering if anyone had any experience with this.
Never mind, now it works.


>
> =================================
> import sys
>
> def mytrace(frame, event, arg):
>     print "tracing..."
>
> sys.settrace(mytrace)
>
> def foo():
>     for i in range(5):
>         print i
>
> foo()





More information about the Python-list mailing list