We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

The signal module

This module is used to install your own signal handlers. When the interpreter sees a signal, the signal handler is executed as soon as possible.

Example: Using the signal module
# File: signal-example-1.py

import signal
import time

def handler(signo, frame):
    print "got signal", signo

signal.signal(signal.SIGALRM, handler)

# wake me up in two seconds

now = time.time()


print "slept for", time.time() - now, "seconds"

got signal 14
slept for 1.99262607098 seconds