
December 1st, 2003, 05:58 PM
|
|
Contributing User
|
|
Join Date: Sep 2003
Posts: 36
Time spent in forums: < 1 sec
Reputation Power: 10
|
|
|
Rietrieving cookies help again
This is an example script that sets a cookie, i made it up real fast so it might have a slight error in it somewhere.
import Cookie
import id
id = id.generateid()
IFcookie = Cookie.SimpleCookie()
IFcookie['id'] = id
IFcookie['usrname'] = 'conrad'
print IFcookie
print 'Content-type: text/html\n'
print 'cookie set'
This is where i run into problems this is the code i use to retrieve these cookies:
#!/usr/bin/python
import cgitb
import Cookie
import os
cgitb.enable()
value = os.environ['id']
print "Content-type: text/html\n"
print value
It says its a Key Error and that 'mapping key cannot be found'
it points the error at this statement:
value = os.environ['id']
the error message says that it cannot find id
even though i check my cookie list in mozilla and see that its there. Any help would be appreciated.
BTW this is the last peice I need to implement before i put an alpha vrsion of my forums up. Next I'll need to rewrite them into oop before beta and release.
|