Put a global statement at the top of your function and you should be good:
def onLoadFinished(result):
global feed
...
To demonstrate what I mean, look at this little test:
x = 0
def t():
x += 1
t()
this blows up with your exact same error where as:
x = 0
def t():
global x
x += 1
t()
does not.
The reason for this is that, inside t
, Python thinks that x
is a local variable. Furthermore, unless you explicitly tell it that x
is global, it will try to use a local variable named x
in x += 1
. But, since there is no x
defined in the local scope of t
, it throws an error.