A simple Python CGI server?

D

Dfenestr8

Hi.

I'm just a hobbyist and I like mucking around with cgi scripts.

Here's the script I've been using......
#! /usr/bin/python

import BaseHTTPServer
import CGIHTTPServer
httpd = BaseHTTPServer.HTTPServer(('',8000),
CGIHTTPServer.CGIHTTPRequestHandler)
httpd.serve_forever()


For some reason, I get these weird permission errors sometimes when I use
it ... such as:

"OSError: [Errno 13] Permission denied"

Sometimes my scripts produce this error, sometimes they don't. Can anybody
explain this?

Also, can anyone direct me to a script on the web that might do the trick
a little more consistently?
 
C

Chris Liechti

Dfenestr8 said:
I'm just a hobbyist and I like mucking around with cgi scripts.

did you look ak CGIHTTPServer.py's "test()" function? you can actualy run
that module to get your server.

[...]
For some reason, I get these weird permission errors sometimes when I
use it ... such as:

"OSError: [Errno 13] Permission denied"

Sometimes my scripts produce this error, sometimes they don't. Can
anybody explain this?

on different scripts? or on the same wheny ou try it several times?
if its the former problem, make sure that you save all your cgis with
"#!/usr/bin/env python" (or similar) as the first line, make it executable
and world readable (chmod a+rx script.py")

chris
 
D

Dfenestr8

Dfenestr8 said:
I'm just a hobbyist and I like mucking around with cgi scripts.

did you look ak CGIHTTPServer.py's "test()" function? you can actualy run
that module to get your server.

[...]
For some reason, I get these weird permission errors sometimes when I
use it ... such as:

"OSError: [Errno 13] Permission denied"

Sometimes my scripts produce this error, sometimes they don't. Can
anybody explain this?

on different scripts? or on the same wheny ou try it several times? if its
the former problem, make sure that you save all your cgis with
"#!/usr/bin/env python" (or similar) as the first line, make it executable
and world readable (chmod a+rx script.py")

chris

Ta. It was a permission-related problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top