Signal problem

Jeffrey Froman jeffrey at fro.man
Thu Mar 27 16:12:47 EDT 2008


Fabio Durieux Lopes wrote:

 
> def signalHandler(signum, frame):
>       terminate = True

This creates a new variable named "terminate" inside the signalHandler
function's local scope. To adjust the value of a module-level global from
inside a function, use the "global" keyword:


def signalHandler(signum, frame):
    global terminate
    terminate = True


Jeffrey



More information about the Python-list mailing list