how do you expect to run such code in a python environment ?
the first loop of that cycle tries to create a key within an empty
dictionary with a value from an empty dictionary .... it's going to fail
every time if row.data isn't in the dictionary yet.
On Sunday, June 16, 2013 9:51:15 AM UTC+2, Jayakumar Bellie wrote:
>
> I have to create a has table like
> { '1':'data1', '2':'data2', '10':'data3', '50':'data4' }
>
> I get the data from the database, here is the code where I format the data
>
> 1 dataTypeList = {}
> 2 for row in result:
> 3 dataTypeList[row.number_indicator] = dataTypeList[row.data]
>
> I get KeyError: 1L error in line 3
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.