Simon Forman wrote: > > > Ok, seriously, I don't know how pydoc does it, but when I need a > quick-and-dirty http server [written in python] I use something like > this: > > from BaseHTTPServer import HTTPServer > from SimpleHTTPServer import SimpleHTTPRequestHandler > > HTTPServer(('', 8000), SimpleHTTPRequestHandler).serve_forever() > > For what you're asking about you'd probably want to use the > CGIHTTPRequestHandler from the CGIHTTPServer module instead. Check out > http://docs.python.org/lib/module-CGIHTTPServer.html
This is what i was after, thanks for the tip. > Then you'd just write one or more cgi scripts (they can be in python > IIRC) to run the commands you want. Im having trouble running the following cgi script on windows <code> #!c:/Python/python.exe -u text = """Content-type: text/html <TITLE> CGI 101 </TITLE> <H1>A Second CGI script</H1> <HR> <P>Hello, CGI World!</P> """ print text </code> using this http server from http://effbot.org/librarybook/cgihttpserver.htm <code> import CGIHTTPServer import BaseHTTPServer class Handler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = ["/cgi"] PORT = 8000 httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) print "serving at port", PORT httpd.serve_forever() </code> i get the error number 403, when i try to access the cgi script which is located in a subdirectory called cgi where this file is (http server). I have a feeling that i need to change the Handler class or something, implement , but i couldnt find any examples other then this from eff-bot. It could also be this line of code, that a google search turned up, its the way of running cgi scripts on windows #!c:/Python/python.exe -u Cheers -- http://mail.python.org/mailman/listinfo/python-list