2012/10/25 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
On Wed, 24 Oct 2012 13:51:30 +0100, andrea crotti wrote:
So I would like to be able to ask for confirmation when I receive a C-c,
and continue if the answer is N/n.
I don't think there is any way to do this directly.
Without
On Thu, Oct 25, 2012 at 12:15 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
I don't believe that there is any
way to jump back to the line of code that just failed (and why would you,
it will just fail again)
There are several reasons to retry something after an exception,
On 24/10/12 14:51:30, andrea crotti wrote:
So I would like to be able to ask for confirmation when I receive a C-c,
and continue if the answer is N/n.
I'm already using an exception handler set with sys.excepthook, but I
can't make it work with the confirm_exit, because it's going to quit in
On Fri, 26 Oct 2012 01:51:43 +1100, Chris Angelico wrote:
On Thu, Oct 25, 2012 at 12:15 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
I don't believe that there is any
way to jump back to the line of code that just failed (and why would
you, it will just fail again)
On Fri, Oct 26, 2012 at 2:31 AM, Hans Mulder han...@xs4all.nl wrote:
This seems to work; I'm not sure how robust it is:
import signal
def handler(signum, frame):
while True:
q = raw_input(This will quit the program, are you sure? [y/N])
if q[:1] in yY:
andrea crotti wrote:
2012/10/25 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
On Wed, 24 Oct 2012 13:51:30 +0100, andrea crotti wrote:
[snip]
Without a try...except block, execution will cease after an exception is
caught, even when using sys.excepthook. I don't believe that there
So I would like to be able to ask for confirmation when I receive a C-c,
and continue if the answer is N/n.
I'm already using an exception handler set with sys.excepthook, but I
can't make it work with the confirm_exit, because it's going to quit in
any case..
A possible solution would be to do
On Wed, 24 Oct 2012 13:51:30 +0100, andrea crotti wrote:
So I would like to be able to ask for confirmation when I receive a C-c,
and continue if the answer is N/n.
I don't think there is any way to do this directly.
Without a try...except block, execution will cease after an exception is