signal module?

Daniel Nielsen djn at
Thu Mar 27 11:05:25 CET 2003

On 27/03-03 10.55, Martin v. Löwis wrote:
> > I'm using threads, so I'd like ctrl-c to actually terminate the
> > program. If my memory serves me, ctrl-c is SIGINT, so in my code, in
> > the main thread, I write:
> Notice that Python already binds SIGINT, to install a handler that raises
> a KeyboardInterrupt.

I realise this, but that handler doesnt get the signal either...
"Threads interact strangely with interrupts: the KeyboardInterrupt
exception will be received by an arbitrary thread. (When the signal
module is available, interrupts always go to the main thread.)"

I don't know what to make of this, except that KeyboardInterrupt isn't
always raised in the main thread, unless you use the signal module


There are no great men, only great challenges that ordinary men are forced
by circumstances to meet.
		-- Admiral William Halsey

More information about the Python-list mailing list