Re: Keyboard Interrupts
Donn Cave (donn@u.washington.edu)
25 Feb 1995 21:05:34 GMT
glenc@netcom.com (Glen Collins) writes:
| I would like to know if there is is a way to specify in python to
| ignore keyboard interrupts(^C). I would like to do this a the very
| beginning of the script. There are thress way I can see of doing
| this, but I would prefer to do it within python.
|
| #1. Us try/except statements throughout the script (too many!)
| #2. Patch python to ignore all SIGINT's
| #3. Compile python with a "SIGNAL" type of library able to use include
| statements.
#4. Change the terminal driver setting for the INTR key. Problems:
a. Not specific to python process, so it has to be restored afterwards.
b. No python function (that I know of) to do it, though not much work
to invoke stty. A POSIX termios module would be doable.
c. UNIX only, though other systems may have equivalent.
Donn Cave, University Computing Services, University of Washington
donn@cac.washington.edu