Newbie: A very basic problem related to cgi.py

Peter Hansen peter at engcorp.com
Mon Dec 20 16:02:27 CET 2004


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...)

-Peter



More information about the Python-list mailing list