Why does Cookie method fail???

David Lees DavidL.nono.spam.nono at raqia.com
Wed Nov 15 19:09:07 EST 2000


I have the code below in a cgi-bin file (junk.py) and an error occurs
when I uncomment the statement: c = Cookie.Cookie()
I get the error:

TypeError:  Call of non-function (type module), in the Apache error_log

This seems wierd, because the form fields are correctly passed and I am
able to send them back to the form.  It also does not make any
difference whether I use Python 1.5.2 or Python 2.0.  Note the HTML form
receives the Python version number and this works.

Puzzled.

David Lees



#!/usr/local/bin/python
import cgi, os, sys, Cookie

def memberform():

    list={}

    print "Content-type: text/html"
    print

    form1 = cgi.FieldStorage()

    first=form1["first"].value
    last=form1["last"].value
    email=form1["email"].value
    fan=form1["fan"].value

    list["first"]=first
    list["last"]=last
    list["email"]=email
    list["fan"]=fan

    print "<H1> Cookie Testing!</H1>"
    #c = Cookie.Cookie()
    #c.load(os.environ["HTTP_COOKIE"])

    print '<P>The name is '+first+'</P>'

    print '<P>Python Version = '+sys.version+'</P>'


if __name__ == "__main__":
    memberform()





More information about the Python-list mailing list