UnboundLocalError: local variable '_[1]' referenced before assignment

Gabriel Rossetti gabriel.rossetti at arimaz.com
Wed Dec 9 05:17:08 EST 2009


Hello everyone,

I get this error on python 2.6.1 on mac os x 10.6 :

UnboundLocalError: local variable '_[1]' referenced before assignment

here's the code that raises this:

params = [ self.__formatData(paramProcFunc, query, p) for p in params ]

what I don't get is that it worked on mac os x 10.5 (python 2.5.x) but 
it no longer works. I tried the following and it works :

r = []
for p in params:
    r.append(self.__formatData(paramProcFunc, query, p))
params = r

Does anyone understand what is going on here?

Thank you,
Gabriel



More information about the Python-list mailing list