When creating a Python script at DreamHost, there are certain rules that must be followed to ensure the file functions properly.
All Python CGI scripts on DreamHost must end with the following extensions:
First line of the Python file
The very first line of the file must be any of the following:
The file's permissions must be set to 755. You can change this by running the following command via SSH.
[server]$ chmod 755
Make sure to use UNIX style newlines, not Windows.
If you want to view printed output from your Python code, you must add this as the first line of output:
print "Content-type: text/html\n\n"
At DreamHost, all Python CGI scripts AND their immediate parent directory must have their Unix user and Unix group left set to your domain's Unix user AND that user's DEFAULT Unix group (otherwise you will get an internal server error from Apache's suexec).