gpt4 book ai didi

Python 标准库,signal::AttributeError:模块 'signal' 没有属性 'SIGALRM'

转载 作者:行者123 更新时间:2023-12-05 02:17:31 26 4
gpt4 key购买 nike

我正在尝试设置函数超时,但我无法成功。

我运行来自 https://docs.python.org/3/library/signal.html?highlight=signal%20sigalrm#example 的示例代码

但是,我得到了 AttributeError

我在 Windows10 上使用 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

关于Python 标准库,signal::AttributeError:模块 'signal' 没有属性 'SIGALRM',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47545002/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com