abort python script from trace function
David.Stark at intusurg.com
Tue Jul 26 10:56:23 EDT 2011
I ended getting the desired result by registering a new trace function. In my existing trace function I check the status of the abort button. When it's been triggered I register a NEW trace function using PyEval_SetTrace. I also use PyEval_SetProfile and point them both at my new trace function. The new trace function just raises a python exception using PyErr_SetString. Then I return -1 from the trace function. It gets called several times but eventually the script dies. This works even when the python script running is an insane set of nested try/except loops.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list