sys.settrace() and stopping the Python interpreter

Francis Joanis fjoanis at videotron.ca
Mon Jun 2 13:47:36 CEST 2003


Hello everyone,

I am relatively new to Python and I am looking forward to embed it
under a C++ application (gcc/linux) to add scripting capability.

I've seen various posts about being able or not to stop the execution
of a running Python script based on whatever conditions.

>From what I've seen there is no built-in ways of doing this directly
as a Python feature since it was not designed/implemented.

On the other hand, I've experimented with the sys.settrace function
(in order to do some condition checking then to raise an exception to
stop the interpreter) but from what I've seen, setting up a trace
function won't take care of Python's built in functions (like
'print').

I'd like to know if there is a way to set a trace function to process
every instructions?

Thanks,

Francis Joanis




More information about the Python-list mailing list