Interrupting Python

Erik Max Francis max at
Fri Sep 6 16:06:51 EDT 2002

Bob Easton wrote:

> I have a script that can run, accessing network resources, for several
> days.
> Since the script does not normally need keyed input, exception
> processing
> does not raise the keyboard exception until after the program ends
> normally.
> I would like to be able to interrupt if from the keyboard, but have
> not
> learned the trick.  How can I do this?

If you're under a UNIX-like operating system, kill its process ID with
the -INT signal.

	kill -INT processID

You can find the process ID with ps if you don't already know it.

 Erik Max Francis / max at /
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ There is nothing so subject to the inconstancy of fortune as war.
\__/ Miguel de Cervantes
    Church /
 A lambda calculus explorer in Python.

More information about the Python-list mailing list