I wanted to catch a SIGHUP
signal in my Python program. But I ran into the problem that Python doesn't recognize the signal name:
import signal
import time
def handler(sig, frame):
print("SIGNAL:", sig)
signal (SIGHUP, handler)
while True:
time.sleep(1)
Python does not recognize SIGHUP
and gives an error. Anyone knows how to fix it?