4
votes

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

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

1
Is Python installed through Cygwin? - Blender
A signal is a Posix thing and most likely won't work on Windows. Cygwin is just translation layer and may not translate signal semantics to whatever Windows uses (but I'm not sure, I'd have to test it). - Keith
Indeed, installing Python through Cygwin (setup-x86_64.exe in my case) fixed the problem for me. - Josiah Yoder

1 Answers

6
votes

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

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

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