Reputation: 4873
To begin, yes there are other similarly titled questions, no this is not a duplicate.
I'm having a very odd problem when I'm using python and CGI on my webserver.
The following gives the indicated error
#! /python34/python
import cgi, Cookie, os
print("Content-Type: text/html\n")
print("Output")
However, if I don't import Cookie, it works
#! /python34/python
import cgi, os
print("Content-Type: text/html\n")
print("Output")
Any ideas on this?
Upvotes: 1
Views: 1552
Reputation: 2818
The tutorial you're following is likely for Python 2. The Cookie
library was renamed to http.cookies
in Python 3. If you run 2to3
over your code it should highlight any changes you need to make.
https://docs.python.org/2/library/cookie.html
Upvotes: 1