En Thu, 15 Nov 2007 16:18:45 -0300, <[EMAIL PROTECTED]> escribió:

> On Nov 15, 9:43 am, [EMAIL PROTECTED] wrote:
>> On Nov 14, 4:20 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
>> wrote:
>>
>> > Not forcibly - you need some cooperation from the Main function. Maybe
>> > setting a global variable that Main checks periodically.
>
> It works but the problem is that the script will be written by the end
> user. If they make a mistake and the cancel flag isn't perodically
> checked then it seems I have no way of cleanly ending the interpreter.
> If I wait for a specific time after requesting the Main function stop
> I need to be able to kill the interpreter without a runtime error. Any
> ideas?

You could use PyThreadState_SetAsyncExc - it's supposed to raise an  
exception in another thread. There is a Cookbook recipe using it here  
<http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496960>
I've never actually used it, but I want to try it some day, so please  
report back your findings if you decide to use this function.

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to