getfirst and re

Carsten Haese carsten.haese at gmail.com
Fri Jan 8 15:55:17 CET 2010


Victor Subervi wrote:
> First I get scolded for not including enough information. Now I get
> scolded for including too much. Seems I can't win. I *am* putting effort
> into understanding this. I'm sorry I'm not as sharp as you are in these
> matters.

I didn't scold you for including too much information. I scolded you for
not demonstrating any effort on your part to try to figure out the
problem. Maybe you did put effort into figuring it out, but you didn't
show us any of it. You simply threw your entire code out there and asked
an open-ended question that gave us no insight into your thought process.

> params = {}, key = 'store', global cgi = <module 'cgi' from
> '/usr/lib64/python2.4/cgi.pyc'
>>, cgi.FieldStorage = <class cgi.FieldStorage>, ].value undefined
> 
> TypeError: unsubscriptable object
>       args = ('unsubscriptable object',)
> 
> Why is the value undefined? What is an unsubscriptable object?

At least those are specific questions. "value undefined" means that the
cgitb traceback is unable to show a meaningful value for the object
known as <<cgi.FieldStorage>>. Maybe you should ask yourself why that is
and why you're operating on an object that doesn't have a meaningful value.

An unsubscriptable object is an object that can't be subscripted. In
other words, it's an object <<foo>> for which the expression foo[bar] is
invalid and results in exactly the kind of exception you're struggling
with right now.

-Carsten




More information about the Python-list mailing list