Problems getting Python scripts to run on server

I V ivlenin at gmail.com
Thu Jan 24 00:51:20 EST 2008


On Wed, 23 Jan 2008 19:41:17 -0800, Yansky wrote:
> Hi, I'm having a lot of problems getting any Python scripts to run on my
> website. I have put them in the cgi-bin directory and chmodded both the
> directory and files to 755. But when I try to access the script, I get a
> 404 error: http://forboden.com/cgi-bin/wp.py

Note that you don't get a 404 error _from the web server_ - you get it 
from wordpress (or at least, I do when I look at your page). So what I 
think is happening is that either the server, or wordpress, doesn't see a 
file at the URL "/cgi-bin/wp.py", and so it thinks your are trying to 
access a wordpress post, and http://forboden.com/cgi-bin/wp.py is getting 
translated to http://forboden.com/index.php/cgi-bin/wp.py . 

I suspect the problem is in the rewrite rules in the .htaccess in your 
root directory. My wordpress installation has these rewrite rules:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Which, as I understand it mean "not a file" and "not a directory" 
respectively. If your cgi-bin is not in your document root, presumably 
cgi-bin/wp.py will indeed show up as not being a file or directory. I'm 
no mod_rewrite wizard, but looking at the docs[1], maybe you could 
replace those two lines above with:

RewriteCond %{REQUEST_URI} !-U

(thought the docs say this "can impact your server's performance!") I'm 
just guessing at the cause of your problem, but I hope this helps.

[1] http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html



More information about the Python-list mailing list