donn@u.washington.edu (Donn Cave):
> #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.
Actually, Glenn can solve his problem with the signal module -- this
is present though undocumented in 1.1(.1) and will be a first-class
citizen in 1.2. Try this:
import signal
signal.signal(signal.SIGINT, signal.SIG_IGN)
The signal module is not intended to be UNIX specific but I haven't
heard whether it can be used on non-UNIX systems -- most Mac/PC
compilers I know of don't support signal() in a way that makes it
possible to use the signal module (it requires that signal handlers
really run asynchronously).
Note that there's also a termios module (again undocumented) in 1.1,
so you could also implement Donn's suggestion.
--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>