Hey Philippe,
Thanks exactly what I wanted.
My main() is calling other scripts written in powershell(.PS1) using 
subprocess.call().
Will this mechanism work in that case also ? I mean will this resume the 
execution from the same place where it left off as desired ?

Nikunj

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of 
Philippe May
Sent: Sunday, November 20, 2011 7:25 PM
To: [email protected]
Subject: Re: [BangPypers] "continue" in "try..except"

Resuming the execution in an except clause seems unclean and unlikely. What 
about the context? Where in the stack to resume? This would lead to more 
problems than anything else.

Here i think we are basically not dealing with exceptions but signals, and this 
might work as expected:

import signal
def signal_handler(signal_number, frame):
    ret = raw_input('Really abort? (y/n) ')
    if ret == 'y':
        print('Committing Hara Kiri')
        sys.exit(0)

## Install the signal handler:
signal.signal(signal.SIGINT, signal_handler)

Philippe

> From: Navin Kabra <[email protected]>
>> 
>> On Sun, Nov 20, 2011 at 2:48 PM, <[email protected]> wrote:
>> 
>>> Are you 100% certain that this mechanism is not available in Python.?
>>> I think this is very generic usecase of exception handling. !?
>>> 
>> 
>> While I'm not 100% certain that this is not available in Python, I am 100%
>> certain that this is not a "generic usecase of exception handling". Can you
>> give examples in other languages?
>> 
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to