Newbie: A very basic problem related to cgi.py

Steve Holden steve at holdenweb.com
Mon Dec 20 16:18:24 CET 2004


Peter Hansen wrote:

> Steve Holden wrote:
> 
>> Traceback (most recent call last):
>>   File "cgi.py", line 2, in ?
>>     import cgi
>>   File "/c/steve/cgi.py", line 12, in ?
>>     main()
>>   File "/c/steve/cgi.py", line 6, in main
>>     form = cgi.FieldStorage()
>> AttributeError: 'module' object has no attribute 'FieldStorage'
>>
>> Ha! There's a naming confusion between the imported cgi module and 
>> your main program. Rename it to something else and all should be well 
>> (or at least better ;-)
> 
> 
> I suspected that too, Steve, but why would it be showing
> the library cgi.py in the traceback if he had a local
> one with the same name?  Weird.  (Unless, as I wondered
> in my redundant reply, the traceback he posted wasn't
> the real traceback...)
> 
It *is* a little puzzling.

I suspect that the problem might have been due to repeated imports or 
some such. But I don't know. Only Ali can tell us how he got that 
traceback. I wondered whether it could have been an IDE, but neither 
IDLE nor PythonWin exhibit such strangeness. Very odd. Ali?

regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list