Interrupting execution of PyRun_SimpleScript()

stephan antonxx at gmx.de
Tue Apr 26 07:00:17 EDT 2005


Hi,

Im am using PyRun_SimpleString() inside a BCB 5.0 GUI app
on win32.

All works fine.

The PyRun_SimpleStript() runs a piece of python
code which calls often a callback function to
refresh my gui App so my Form still can react
to user input.

Now, I would like to implement a possibility
to interrupt the execution.

For this I have a button called "stop", and when
the user executes it, I generate an exeption by
calling:
PyRun_SimpleString("raise KeyboardInterrupt\n").

I see in the window where I redirected stderr and stdout
the exception, but the original code (a for loop)
still continues to run.

Does there somebody have some idea (in the Python FAQ
i didnT find anything)

Thanks

 Anton



More information about the Python-list mailing list