python signal OSError [Errno 22] Invalid argument错误
错误代码内容:
import signal
def signal_handler(sig, frame):
pass
signal.signal(signal.SIGKILL, signal_handler)
报错:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/python3/lib/python3.8/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
OSError: [Errno 22] Invalid argument
错误原因:
From the man 7 signal, it says
The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.
参考资料: