I\'m trying to get Python scripts, called from a web browser, to work. I keep getting the error:
500 Internal Server Error
When I check my err
If you have configured Apaches httpd file correctly then you might be getting this error for following two reasons.Make sure these are correct.
do you have something like this at the top before you print anything else?
print "Content-type: text/html\n"
If you already have this, then post your code.
OK last guess:
Trying changing that shebang line to:
#!/usr/bin/env python
or
#!/usr/bin/local/env python
It would also be helpful to know your platform / hosting provider.
You can also get some of this same foolishness if you have DOS style end of lines on a linux web server. (That just chewed up about two hours of my morning today.) Off to update my vim.rc on this windows box that I need to use.
This ended up being a dos2unix
issue for me. Ran dos2unix test.py test.py
and it worked. The \r\n
combinations were the problem. Had to yum install dos2unix
to get it installed.
This is the exact behavior you would get if your Python script does not have the executable permission set.
Try:
chmod a+x foo.py
(where foo.py is your script name).
See the Apache tutorial for more information.