Embedded python: how to force a break to endless looping Python script?

Warren Postma embed at NOSPAM.geocities.com
Tue Aug 22 14:07:18 EDT 2000


I have an embedded multithreaded C app with Python embedded in it, which
allows the user to remotely log on to our systems, and run certain scripted
commands, which could contain errors, such as the following:

while 1:
        print "run forever...."


I have one thread running Python, and a second thread is a C function that
is taking the output written to the sys.stdout object and redirecting it.
What I would like to do is force a thread to abort execution. I know the
pointer to that thread's ThreadState object but I don't know how to send it
a "Ctrl-C" kind of signal to kill the script.

Can anyone enlighten me on how to do this?

Waren





More information about the Python-list mailing list