Embedding IronPython in a WinForms app and interrupting execution

Posted by namenlos on Stack Overflow See other posts from Stack Overflow or by namenlos
Published on 2010-05-27T16:06:10Z Indexed on 2010/05/27 16:11 UTC
Read the original article Hit count: 655

BACKGROUND

MY PROBLEM

  • Sometimes the users will need to interrupt the execution of their code
  • In other words they need something like the ability to hit CTRL-C to halt execution when running Python or IronPython from the cmdline
  • I want to add a button to the winform that when pressed halts the execution, but I'm not sure how to do this.

MY PROBLEM

  • The users will need to interrupt the execution of their code
  • In other words they need something like the ability to hit CTRL-C to halt execution when running Python or IronPython from the cmdline

MY QUESTION

  • How can I make it to that pressing the a "stop" button will actually halt the execution of the using entered IronPython code?

NOTES

  • Note: I don't wont to simply through away that "session" - I still want the user to be able to interact with session and access any results that were available before it was halted.
  • I am assuming I will need to execute this in a separate thread, any guidance or sample code in doing this correctly will be appreciated.

© Stack Overflow or respective owner

Related posts about ironpython

Related posts about python-embedding