Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

15
  • 5
    I use Python 2.5.4. There is such an error: Traceback (most recent call last): File "aa.py", line 85, in func signal.signal(signal.SIGALRM, handler) AttributeError: 'module' object has no attribute 'SIGALRM' Commented May 13, 2011 at 1:59
  • 23
    @flypen that's because signal.alarm and the related SIGALRM are not available on Windows platforms. Commented Aug 19, 2011 at 16:20
  • 5
    If there are a lot of processes, and each calls signal.signal --- will they all work properly? Won't each signal.signal call cancel "concurrent" one? Commented May 10, 2012 at 8:28
  • 25
    I second the warning about threads. signal.alarm only works on main thread. I tried to use this in Django views - immediate fail with verbiage about main thread only. Commented Apr 2, 2015 at 6:51
  • 3
    Please specify this will work only on linux systems, as windows doesn't have the signal.SIGALMR signal. At least, this is what happened to me. A good alternative to thjis which works on all systems is to use multiprocessing Commented Aug 12, 2021 at 9:27