Where to put Python scripts?

Avatar
  • Answered
I'm just getting started working in Python, and I'm not yet able to have the server run a python script. I've pretty much only tried putting the script in the cgi-bin directory. I'm not sure what to do next.

Thanks,
Amos
Avatar
jamesr
Thank you for your question Amos! Python scripts do need to be in the cgi-bin folder. Also, you will need the permissions to be 775 or 755 and not 777. 777 can cause internal server errors. We created a test script in your cgi-bin to show the .py working. Please check the following. yourdomain.com/cgi-bion/test.py This is the code we used:
#!/usr/bin/env python print "Content-Type: text/html" print print """\ <html> <head> <title>Python - Hello World</title> </head> <body> Hello World </body> </html> """
Unfortunately, from looking at the code you are trying to run, we are not able to determine why your .py is not running. Sorry for this. Unfortunately we do not have any knowledge base on this specific code. Best regards, James R