我正在尝试设置函数超时,但是没有成功。
我运行示例代码https://docs.python.org/3/library/signal.html?highlight=signal%20sigalrm#example
但是,我得到AttributeError
.
我在 Windows 10 上使用 python 3.6.3
这是我的代码。
\>>> import signal
\>>> signal.SIGALRM
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'signal' has no attribute 'SIGALRM'
Windows 不支持 SIGALRM。https://docs.python.org/2/library/signal.html在 Windows 上,signal() 只能通过 SIGABRT、SIGFPE、SIGILL、SIGINT、SIGSEGV 或 SIGTERM 调用。在任何其他情况下都会引发 ValueError
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)