connect SIGINT to custom interrupt handler

Thomas 'PointedEars' Lahn PointedEars at web.de
Fri May 20 03:38:48 EDT 2011


Christoph Scheingraber wrote:

> On 2011-05-15, Thomas 'PointedEars' Lahn <PointedEars at web.de> wrote:
>> 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.
> 
> The problem is that I am running someone else's module which seems to
> use signal, I guess that means I have to create a child method?
> Is it correct anyway to have
> 
> signal.siginterrupt(signal.SIGINT, False)
> 
> in my custom interrupt_handler function

Only if `signal' is not the name of an int argument.

> or should it be outside but
> after signal.signal(signal.SIGINT, interrupt_handler)?

In the meantime, Chris Angelico has pointed out the cause of the problem.  
Please follow his advice, i.e. rename your argument.

-- 
PointedEars

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



More information about the Python-list mailing list