problem with CGIHTTPServer

7stud bbxx789_05ss at yahoo.com
Fri Mar 28 11:38:45 EDT 2008


1) I have this simple cgi server:


import CGIHTTPServer
import BaseHTTPServer

class MyRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler):
    cgi_directories = ['/my_cgi_scripts']

server = BaseHTTPServer.HTTPServer(
        ('', 8111),
        MyRequestHandler
)


server.serve_forever()


2) I have this simple python script:

test.py
--------
#!/usr/bin/env python

import cgitb; cgitb.enable()
import cgi


print "Content-type: text/html"
print
print "hello"


3) I have this simple html page with a link that calls test.py:

<html>
<head>
<title></title>
</head>
<body>

<div>
<a href="http://localhost:8111/my_cgi_scripts/test.py">click me</a>
</div>

</body>
</html>


My directory structure looks like this:

../dir1
-------myserver.py
-------/my_cgi_scripts
----------------test.py

After I start the server script, load the html page in my browser, and
click on the link, I get the desired output in my browser, but the
server script outputs the following in my terminal:

localhost - - [28/Mar/2008 08:51:22] "GET /my_cgi_scripts/test.py HTTP/
1.1" 200 -
localhost - - [28/Mar/2008 08:51:22] code 404, message File not found
localhost - - [28/Mar/2008 08:51:22] "GET /favicon.ico HTTP/1.1" 404 -


What are the error messages on lines two and three?




More information about the Python-list mailing list