cgi problems

Rob Elder relder at omegabit.com
Mon May 22 17:24:54 EDT 2000


Hello,

   I'm having inconsistencies and errors trying to use cgi.py. 

- cgi is imported
- formData is set to cgi.FieldStorage()

- len(formData) gives me the correct number of fields with data
- formData['userID1].value gives a correct data value
- formData.keys() gives a list of keys

But

- formData.values() gives an error message:

Traceback (innermost last): File "C:\WebSite\cgi-shl\workingTest.py", line
29, in ? print formData.values() File "C:\Python152\Lib\cgi.py", line 888,
in__getattr__ raise AttributeError, name AttributeError: values

Also if some the fields on my test form are not filled in, the following
error message is generated:

Traceback (innermost last): File "C:\WebSite\cgi-shl\workingTest.py", line 20, 
in ? print formData['userID1'].value File "C:\Python152\Lib\cgi.py", line907, 
in __getitem__ raise KeyError, key KeyError: userID1

These two different problems relate back to values in the form. I don't
know how to think about this. I have looked through the FAQs, docs and
html. Maybe I am just missing the simplest things. Off-line all my
dictionary calls work without any problems.

-r



More information about the Python-list mailing list