[Catalog-sig] RE: Assistance with Python Classes
Wed, 18 Jul 2001 11:31:44 -0500
> Hi there can someone please assist me
> I am a perl programmer learning python. I keep on getting an exception =
> NameError: global name 'cgi' is not defined
I'm not sure how you ended up posting to this mailing list, but this kind of
question is really more appropriate for the general interest Python
newsgroup (comp.lang.python) or mailing list. In the future, please keep in
mind the purpose of the Catalog SIG when posting to this list. Having said
that, I think the problem with your script may be the placement of the
import statements and the attempt to create a "cgi" object when there is
none. Try this replacement for your WebManager module:
# Import these modules at the top level
# FieldStorage() is a module method for the cgi module;
# there is no cgi class to create.
self.formdata = cgi.FieldStorage()
self.operatingSys = os.name
def getParam(self, name):
return None # not lowercase "none"!
The Python reference documentation for the cgi module has some examples that
may help further.
Hope this helps,