leonardodcrapio Posted June 4, 2014 Posted June 4, 2014 I am trying to run a python test script but am getting a 500 error instead. Permissions are 755 and I added the py extension to Apache Handlers. The link to the test script/my website: http://closedgw.heliohost.org/test.py My question is, what could I be doing wrong?
yashrs Posted June 4, 2014 Posted June 4, 2014 This might help: http://www.heliohost.org/home/features/languages/python Also, if you could post your script, so that we can come to know the problems. Also, they should be kept in the cgi-bin directory to be executed.Python scripts are easy to configure and run. Just create a file in your cgi-bin directory under public_html, and place the Python "shebang" line (#!/usr/bin/python) on the first line of the file. Below this line you may write Python code. Make sure you make this file's CHMOD permissions 755, and output a Content-type header before anything else. 1
leonardodcrapio Posted June 4, 2014 Author Posted June 4, 2014 I just moved the script to /cgi-bin/ and added the shebang line. The script is located at: closedgw.heliohost.org/cgi-bin/test.py and the index page is present when you go to closedgw.heliohost.org. I am still not getting the expected results. Which is the printing of number 1-10.
yashrs Posted June 4, 2014 Posted June 4, 2014 Can you post the script here ? Also, have you added the content/type header ? Also, a syntax error in Python can cause this error.
leonardodcrapio Posted June 4, 2014 Author Posted June 4, 2014 script:#!/usr/bin/pythonprint "Content-type: text/html"print "Python code is working" Excuse my ignorance but I don't understand your second question. It has been a long time since I have messed around with a website. edit: I modified the script to print the string, "Python code is working". So, it should no longer print 1-10.
yashrs Posted June 4, 2014 Posted June 4, 2014 You are using wrong syntax of print statement for Python. http://yash.heliohost.org/cgi-bin/1.py #!/usr/bin/python print('Content-Type: text/plain\n\n'); print('Python is working!'); 1
leonardodcrapio Posted June 4, 2014 Author Posted June 4, 2014 D'oh.I forgot to check the python version.. Thanks.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now