[Tutor] THE CGI SERVER SCRIPT
Ole Jensen
learning.python at dbmail.dk
Sun Sep 14 11:46:05 EDT 2003
Concerning the before mentioned cgi script by Steve Holden and Kirk Bailey,
well I've now tried to experiment with it but I didn't get very far!
As a matter of fact I was not even able to run the server, I get a traceback
saying it can't find a a/some module(s).
This is the the traceback:
Traceback (most recent call last):
File "C:\Programmer\python\cgi.py", line 2, in ?
import CGIHTTPServer, BaseHTTPServer
File "C:\PROGRA~1\python\lib\CGIHTTPServer.py", line 28, in ?
import SimpleHTTPServer
File "C:\PROGRA~1\python\lib\SimpleHTTPServer.py", line 17, in ?
import cgi
File "C:\Programmer\python\cgi.py", line 3, in ?
httpd=BaseHTTPServer.HTTPServer(('',8080),
CGIHTTPServer.CGIHTTPRequestHandler)
AttributeError: 'module' object has no attribute 'CGIHTTPRequestHandler'
Traceback (most recent call last):
File "C:\Programmer\python\cgi.py", line 3, in ?
httpd=BaseHTTPServer.HTTPServer(('',80),
CGIHTTPServer.CGIHTTPRequestHandler)
AttributeError: 'module' object has no attribute 'CGIHTTPRequestHandler'
Quite alot actually (compared to what I'm used for), I can't say that I
fully undstand it, but the way I understand it the error is in the imported
modules (is that possible!!!)
I use Python 2.2.3 on WinXP, if that matters.
The only changes I made to the cgi script was adjusting the libray info in
the first line, and the port number to 8080 (which I did try to set to 80,
afterwards).
The file has been placed in the (root) python library (next to python.exe
etc).
I've never been working with cgi-script, let alone setting up cgi servers on
my PC, so I don't really know it is something I've done wrong as it sounded
like Kirk got it up and running.
I am looking forward to any replies/solutions.
Olé
Below is the cgi code:
#!C:\Programmer\python\pythonw.exe
import CGIHTTPServer, BaseHTTPServer
httpd=BaseHTTPServer.HTTPServer(('',80),
CGIHTTPServer.CGIHTTPRequestHandler)
httpd.serve_forever()
More information about the Tutor
mailing list