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

Richard Thomas chardster at gmail.com
Wed Dec 9 07:40:11 EST 2009


On Dec 9, 10:17 am, Gabriel Rossetti <gabriel.rosse... at arimaz.com>
wrote:
> 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

That isn't an error that should occur, not least because _[1] isn't a
valid name. Can you post a full traceback?

Richard.



More information about the Python-list mailing list