Python 信号即使在 Cygwin 上也不起作用? [英] Python signal don't work even on Cygwin?

查看:39
本文介绍了Python 信号即使在 Cygwin 上也不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使我在 Cygwin 中运行 python 脚本,Python 信号似乎也不适用于 Windows.我收到 AttributeError: 'module' object has no attribute SIGALRM

Python signal doesn't seem to work on Windows even if I run the python script inside Cygwin. I'm getting the AttributeError: 'module' object has no attribute SIGALRM

有没有办法在 Windows 上解决这个问题.我只是在 http://docs.python.org/末尾运行示例2/library/signal.html

Is there a way to go around this on Windows. I'm just running the example at the end of http://docs.python.org/2/library/signal.html

推荐答案

SIGALRM 在 Windows 中不起作用.来自文档:

SIGALRM doesn't work in Windows. From the documentation:

在 Windows 上,signal() 只能用 SIGABRT、SIGFPE、SIGILL、SIGINT、SIGSEGV 或 SIGTERM 调用.在任何其他情况下都会引发 ValueError.

On Windows, signal() can only be called with SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, or SIGTERM. A ValueError will be raised in any other case.

这个问题解决了获取SIGALRM 在 Windows 中等效.而这个问题也类似.

This question addresses the topic of getting a SIGALRM equivalent in Windows. And this question is also similar.

这篇关于Python 信号即使在 Cygwin 上也不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆