Error
Philip Semanchuk
philip at semanchuk.com
Tue Oct 21 09:34:43 EDT 2008
On Oct 21, 2008, at 9:05 AM, Amie wrote:
> Hi,
>
> what does is the meaning of this error: int object is unsubscriptable.
> This is the code that I have written that seems to give me that:
>
> def render_sideMenu(self, ctx, data):
> def render_dataAge(unit):
> results = [(i[0], i[1]
> ) for i in unit]
> return self.dataTable(["Unit Name", "Current Data Age"],
> results, sortable=True),
> return
> self
> .enamel
> .,storage
> .getDataAge(int(self.arguments[0])).addCallback(render_dataAge)
I can't see all of your code so I'm not sure, but it sounds like
you're treating a plain int object as if it was a sequence (like a
list or a tuple). My guess is that "i" in the code above is an int.
Try this Python code in the interpreter and you'll get the same error:
>>> 1[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is unsubscriptable
>>>
-- OR --
>>> i = 1
>>> i[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is unsubscriptable
>>>
More information about the Python-list
mailing list