A simple Python CGI server?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dfenestr8

    A simple Python CGI server?

    Hi.

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

    Here's the script I've been using......
    [color=blue]
    >#! /usr/bin/python
    >
    >import BaseHTTPServer
    >import CGIHTTPServer
    >httpd = BaseHTTPServer. HTTPServer(('', 8000),
    > CGIHTTPServer.C GIHTTPRequestHa ndler)
    >httpd.serve_fo rever()[/color]


    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?

  • Chris Liechti

    #2
    Re: A simple Python CGI server?

    "Dfenestr8" <chrisdewinN0SP AM@yahoo.com.au > wrote in
    news:pan.2003.1 0.31.18.54.52.9 07463@yahoo.com .au:[color=blue]
    > I'm just a hobbyist and I like mucking around with cgi scripts.[/color]

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

    [...][color=blue]
    > 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?[/color]

    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 <cliechti@gmx.n et>

    Comment

    • Dfenestr8

      #3
      Re: A simple Python CGI server?

      On Sat, 01 Nov 2003 00:02:39 +0200, Chris Liechti wrote:
      [color=blue]
      > "Dfenestr8" <chrisdewinN0SP AM@yahoo.com.au > wrote in
      > news:pan.2003.1 0.31.18.54.52.9 07463@yahoo.com .au:[color=green]
      >> I'm just a hobbyist and I like mucking around with cgi scripts.[/color]
      >
      > did you look ak CGIHTTPServer.p y's "test()" function? you can actualy run
      > that module to get your server.
      >
      > [...][color=green]
      >> 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?[/color]
      >
      > 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[/color]

      Ta. It was a permission-related problem.

      Comment

      Working...