locked
How to stop python script from executing

    Question

  • I have an application that hosts IronPython 2.6.1.  The user can choose python scripts to run in order to automate tasks within the application.  I need to have a stop button so the user has a way to stop execution in case something goes wrong.  I've tried calling ScriptRuntime's Shutdown, but that didn't stop execution.  I've looked at the implementation of PythonContext.Shutdown, which I believe to be called by ScriptRuntime.Shutdown, but I don't understand what the deal is with "exitfunc".  Is that the key to get it to work?

    So far, the only way I know that works is to Abort the thread that called ScriptEngine.Execute.  I don't like that at all...

    Thanks!

     

    Tuesday, May 11, 2010 5:02 PM