Web programming in Python.

Paul Boddie paul at boddie.org.uk
Mon Sep 29 15:28:47 CEST 2008

On 29 Sep, 01:51, Kurda Yon <kurda... at yahoo.com> wrote:
> 1. On my server (in my directory) I found "cgi-bin" subdirectory.
> 2. In the "cgi-bin" I have created a file "test.py".
> 3. In that file I put:
> #!/usr/bin/python2.4 python
> print "Hello, World!"
> (I have checked, I have "/usr/bin/python2.4" directory.)

What's the spare "python" for at the end of the first line? You should
also try and run the program directly just to see whether it runs and
what it prints.

> 4. I give the following permissions to the "test.py":
> -rwx---r-x
> 5. The "cgi-bin" directory has the following permissions:
> drwx---r-x

This is probably acceptable.

> 6. In the "cgi-bin" I have created the ".htaccess" file which
> contains:
> Options +ExecCGI
> AddHandler cgi-script .py
> And it still does not work! If I try to see the page by my browser I
> see:
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
> ...

Read the error log, possibly found in a log directory in your home
directory (since you seem to be in a hosting environment, but you'd
look in /var/log/httpd or /var/log/apache for a system-wide Web server
installation) and see what the complaint is. You might also consider
looking at the following page for guidance:



More information about the Python-list mailing list