Re: Catching control-C

2009-07-15 Thread MCIPERF
On Jul 9, 7:28 pm, Miles Kaufmann wrote: > On Jul 9, 2009, at 9:20 AM, Lie Ryan wrote: > > > Michael Mossey wrote: > >> I want to understand better what the "secret" is to responding to a > >> ctrl-C in any shape or form. > > > Are you asking: "when would the python interpreter process > > Keyboar

Re: Catching control-C

2009-07-09 Thread Miles Kaufmann
On Jul 9, 2009, at 9:20 AM, Lie Ryan wrote: Michael Mossey wrote: I want to understand better what the "secret" is to responding to a ctrl-C in any shape or form. Are you asking: "when would the python interpreter process KeyboardInterrupt?" ... In single threaded python program, the currentl

Re: Catching control-C

2009-07-09 Thread Lie Ryan
Michael Mossey wrote: > On Jul 6, 2:47 pm, Philip Semanchuk wrote: >> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: >> >>> What is required in a python program to make sure it catches a >>> control- >>> c on the command-line? Do some i/o? The OS here is Linux. >> You can use a try/except to

Re: Catching control-C

2009-07-08 Thread Nick Craig-Wood
Steven D'Aprano wrote: > On Mon, 06 Jul 2009 15:02:26 -0700, Michael Mossey wrote: > > > On Jul 6, 2:47 pm, Philip Semanchuk wrote: > >> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: > >> > >> > What is required in a python program to make sure it catches a > >> > control- > >> > c on the c

Re: Catching control-C

2009-07-07 Thread Simon Forman
On Jul 6, 6:02 pm, Michael Mossey wrote: > On Jul 6, 2:47 pm, Philip Semanchuk wrote: > > > On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: > > > > What is required in a python program to make sure it catches a   > > > control- > > > c on the command-line? Do some i/o? The OS here is Linux. > >

Re: Catching control-C

2009-07-06 Thread Steven D'Aprano
On Mon, 06 Jul 2009 15:02:26 -0700, Michael Mossey wrote: > On Jul 6, 2:47 pm, Philip Semanchuk wrote: >> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: >> >> > What is required in a python program to make sure it catches a >> > control- >> > c on the command-line? Do some i/o? The OS here is

Re: Catching control-C

2009-07-06 Thread Piet van Oostrum
> Philip Semanchuk (PS) wrote: >PS> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: >>> What is required in a python program to make sure it catches a control- >>> c on the command-line? Do some i/o? The OS here is Linux. >PS> You can use a try/except to catch a KeyboardInterrupt excepti

Re: Catching control-C

2009-07-06 Thread Ben Charrow
Michael Mossey wrote: > On Jul 6, 2:47 pm, Philip Semanchuk wrote: >> On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: >> >>> What is required in a python program to make sure it catches a control- >>> c on the command-line? Do some i/o? The OS here is Linux. >> You can use a try/except to catc

Re: Catching control-C

2009-07-06 Thread Philip Semanchuk
On Jul 6, 2009, at 6:02 PM, Michael Mossey wrote: On Jul 6, 2:47 pm, Philip Semanchuk wrote: On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: What is required in a python program to make sure it catches a control- c on the command-line? Do some i/o? The OS here is Linux. You can use a tr

Re: Catching control-C

2009-07-06 Thread Michael Mossey
On Jul 6, 2:47 pm, Philip Semanchuk wrote: > On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: > > > What is required in a python program to make sure it catches a   > > control- > > c on the command-line? Do some i/o? The OS here is Linux. > > You can use a try/except to catch a KeyboardInterrupt

Re: Catching control-C

2009-07-06 Thread Philip Semanchuk
On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote: What is required in a python program to make sure it catches a control- c on the command-line? Do some i/o? The OS here is Linux. You can use a try/except to catch a KeyboardInterrupt exception, or you can trap it using the signal module:

Re: Catching control-C

2009-07-06 Thread Chris Rebert
On Mon, Jul 6, 2009 at 2:37 PM, Michael Mossey wrote: > What is required in a python program to make sure it catches a control- > c on the command-line? Do some i/o? The OS here is Linux. try: #code that reads input except KeyboardInterrupt: #Ctrl-C was pressed Cheers, Chris -- http://bl

Catching control-C

2009-07-06 Thread Michael Mossey
What is required in a python program to make sure it catches a control- c on the command-line? Do some i/o? The OS here is Linux. Thanks, Mike -- http://mail.python.org/mailman/listinfo/python-list