Re: Terminating an embedded interpreter

2011-09-12 Thread Chris Angelico
On Mon, Sep 12, 2011 at 10:05 PM, Ulrich Eckhardt wrote: > Chris Angelico wrote: >> You can use PyErr_SetInterrupt to raise KeyboardInterrupt > > This sounds useful. Just to make sure, this would be called from a different > thread than the one running the Python script, is that still OK? > >> , b

Re: Terminating an embedded interpreter

2011-09-12 Thread Ulrich Eckhardt
Chris Angelico wrote: > You can use PyErr_SetInterrupt to raise KeyboardInterrupt This sounds useful. Just to make sure, this would be called from a different thread than the one running the Python script, is that still OK? > , but it can be caught by the script. There's no guaranteed way, > sho

Re: Terminating an embedded interpreter

2011-09-12 Thread Ulrich Eckhardt
Steven D'Aprano wrote: > Ulrich Eckhardt wrote: >> I'm trying to provide some scripting capabilities to a program. For that, >> I'm embedding a Python interpreter, running a script in a separate thread >> to decouple it from the UI. >> >> Now, how should I handle rogue scripts? For example, when a

Re: Terminating an embedded interpreter

2011-09-12 Thread Steven D'Aprano
Ulrich Eckhardt wrote: > Hi! > > I'm trying to provide some scripting capabilities to a program. For that, > I'm embedding a Python interpreter, running a script in a separate thread > to decouple it from the UI. > > Now, how should I handle rogue scripts? For example, when a script hangs > in a

Re: Terminating an embedded interpreter

2011-09-12 Thread Chris Angelico
On Mon, Sep 12, 2011 at 8:00 PM, Ulrich Eckhardt wrote: > Now, how should I handle rogue scripts? For example, when a script hangs in > an endless loop, how do I signal the Python interpreter to shut down? In > other words, I want to trigger something like what Control-C does in a > "normal" envir

Terminating an embedded interpreter

2011-09-12 Thread Ulrich Eckhardt
Hi! I'm trying to provide some scripting capabilities to a program. For that, I'm embedding a Python interpreter, running a script in a separate thread to decouple it from the UI. Now, how should I handle rogue scripts? For example, when a script hangs in an endless loop, how do I signal the P