[docs] Documentation python3/library/signal: example does not work: SIGALARM unknow in signal

Berker Peksağ berker.peksag at gmail.com
Wed Aug 1 08:54:47 EDT 2018


On Mon, Jul 30, 2018 at 12:51 PM, Gottfried Müller
<gottfried.mueller at gmx.de> wrote:
> Hello,
>
> I've got this message:
>
> signal.signal(signal.SIGALARM, myHandler)
> AttributeError: module 'signal' has no attribute 'SIGALARM'

Hi Gottfried,

There is a typo in the snippet you've posted. If you replace
'signal.SIGALARM' with 'signal.SIGALRM' (no 'a' after 'l') it should
work:

>>> import signal
>>> def handler(signum, frame): pass
...
>>> signal.signal(signal.SIGALRM, handler)
0

--Berker

> I am using Manjaro/Python version 3.6.6.
>
> Gottfried
>
>
>
>
> _______________________________________________
> docs mailing list
> docs at python.org
> https://mail.python.org/mailman/listinfo/docs


More information about the docs mailing list