A simple Python CGI server?

Discussion in 'Python' started by Dfenestr8, Oct 31, 2003.

  1. Dfenestr8

    Dfenestr8 Guest

    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?
     
    Dfenestr8, Oct 31, 2003
    #1
    1. Advertising

  2. "Dfenestr8" <> wrote in
    news:p:
    > 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

    --
    Chris <>
     
    Chris Liechti, Oct 31, 2003
    #2
    1. Advertising

  3. Dfenestr8

    Dfenestr8 Guest

    On Sat, 01 Nov 2003 00:02:39 +0200, Chris Liechti wrote:

    > "Dfenestr8" <> wrote in
    > news:p:
    >> 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.
     
    Dfenestr8, Nov 1, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. LarsenMTL
    Replies:
    4
    Views:
    800
    Eric Walstad
    Nov 4, 2004
  2. praba kar

    Python-cgi or Perl-cgi script doubt

    praba kar, Jul 30, 2005, in forum: Python
    Replies:
    1
    Views:
    712
    Michael Sparks
    Jul 30, 2005
  3. Amir  Michail

    cgi relay for python cgi script

    Amir Michail, Oct 4, 2005, in forum: Python
    Replies:
    7
    Views:
    447
    Michael Ekstrand
    Oct 4, 2005
  4. epsilon
    Replies:
    4
    Views:
    342
    Gabriel Genellina
    Aug 22, 2007
  5. kath
    Replies:
    4
    Views:
    703
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page