connect SIGINT to custom interrupt handler

Thomas 'PointedEars' Lahn PointedEars at web.de
Sun May 15 11:43:40 EDT 2011


Christoph Scheingraber wrote:

> I now have signal.siginterrupt(signal.SIGINT, False) in the line
> below signal.signal(signal.SIGINT, interrupt_handler)
> 
> Unfortunately, pressing ^c still results in the same interrupt error. I
> also tried putting signal.siginterrupt into the interrupt_handler
> function, which gave an interesting result:
>     File "/usr/local/bin/obspysod", line 586, in interrupt_handler
>     signal.siginterrupt(signal.SIGINT, False)
>     AttributeError: 'int' object has no attribute 'siginterrupt'
> 
> Could there be a namespace problem?

Obviously.  `signal' refers to an `int' object, probably by something like

  signal = 42

before.  E.g. `print' or a debugger will tell you, as you have not showed 
the relevant parts of the code.


Please trim your quotes to the relevant minimum; DO NOT top-post.
Also, it is not acceptable behavior to use domain namespaces without 
authorization (chris at spam.org is not a mailbox, yet spam.org is
registered to someone else).

-- 
PointedEars

Bitte keine Kopien per E-Mail. / Please do not Cc: me.



More information about the Python-list mailing list