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
> 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
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
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