Re: callback confusion

2007-12-09 Thread Gabriel Genellina
En Sat, 08 Dec 2007 14:46:46 -0300, Donn Ingle <[EMAIL PROTECTED]> escribió: > UnboundLocalError: local variable 'kills' referenced before assignment > > I'm amazed that I've spent so much time with Python and something like > that > totally stumps me!? > >> FWIW, this is a FAQ. > If you have

Re: callback confusion

2007-12-08 Thread Donn Ingle
> As far as I can tell, you have a bit more code in boo, and somewhere in > that code (after the print statement), you rebind the name 'kills'. Okay, yes: def boo() kills += 1 print kills > the absence of a global declaration, this makes this name a local > variable. I think I see what you mean

Re: callback confusion

2007-12-08 Thread Bruno Desthuilliers
Donn Ingle a écrit : (snip) > [in one.py] > kills=0 > def boo(): > print kills > > It will abort with: > print kills > UnboundLocalError: local variable 'kills' referenced before assignment As far as I can tell, you have a bit more code in boo, and somewhere in that code (after the print st

callback confusion

2007-12-08 Thread Donn Ingle
Hi, I have two modules, the second is imported by the first. Let's call them one.py and two.py (two being my API) In the first I register a function into the second. [in one.py] def boo(): ... ... two.register( boo ) two.startLoop() In two.py it starts a loop (GTK timeout), so processing remains