Help with my first CGI program???

Gillou nospam at bigfoot.com
Mon Nov 19 15:21:51 EST 2001


cgi.FielStorage() is empty object when called from a command line ! That's
why you got your error.
You can check if you're in a CGI and make some command line tests with this
somewhere in your script :
...
class cgiItemJoker:
  def __init__(self, anyvalue)
    self.value = anyvalue
...
if os.environ.has_key('GATEWAY_INTERFACE'):
  # Called from web server using GCI
 formdata = cgi.FielStorage()
else:
  # Called from command line or other (not web form)
  # Provide some test data...
  formdata = {'akey', cgiItemJoker('avalue'),
      'anotherkey': cgiItemJoker('anothervalue'),
      ...}
# run the body of the CGI script
...

HTH

--Gillou

"Ron Stephens" <rdsteph at earthlink.net> a écrit dans le message news:
3BF95D73.2886D584 at earthlink.net...
> Any help would be appreciated. I am getting a KEYERROR when I run my CGI
> program as a standalone python program. Maybe its just because the
...





More information about the Python-list mailing list