5

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

3
  • 1
    Is Python installed through Cygwin? Commented May 4, 2013 at 6:45
  • 2
    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). Commented May 4, 2013 at 6:47
  • Indeed, installing Python through Cygwin (setup-x86_64.exe in my case) fixed the problem for me. Commented Nov 17, 2016 at 0:12

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Why did this code work on Python 2 on Windows (if I remember right) and break on Python 3 on Windows? Maybe I was using a Python installed through cygwin...
Indeed, installing the Python that comes with Cygwin worked for me.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.