BlackThuder Posted April 18, 2011 Posted April 18, 2011 I have kept a file in cgi-bin with permission set to 755 but it gives an error. Check out the link to find the error http://urjas.heliohost.org/cgi-bin/Hi.py The contents of the file are as follows --------------------------------------------------- #!/usr/bin/python print "Content-Type: text/html \n" print("<html>") print("<body>") print( "Hi there") print("</body>") print("</html>" --------------------------------------------------- It has been uploaded in ASCII mode via FTP. My local machine is windows. Anything that I did wrong to get that Internal server error
Byron Posted April 18, 2011 Posted April 18, 2011 Since I don't know anything about python all I can do is give you a script to try: #!/usr/bin/env python3.2 import cgi cgi.test() import sys ver = sys.version_info print("</br>Python Version:") print(str(ver.major)+'.'+str(ver.minor)+"."+str(ver.micro)) http://dallas.heliohost.org/cgi-bin/python32.py
BlackThuder Posted April 18, 2011 Author Posted April 18, 2011 Since I don't know anything about python all I can do is give you a script to try: #!/usr/bin/env python3.2 import cgi cgi.test() import sys ver = sys.version_info print("</br>Python Version:") print(str(ver.major)+'.'+str(ver.minor)+"."+str(ver.micro)) http://dallas.heliohost.org/cgi-bin/python32.py I want to use version 2.7 can I ?
jje Posted April 18, 2011 Posted April 18, 2011 Try using this as the first line instead #!/usr/bin/env python2.7 I am no Python user either.
BlackThuder Posted April 18, 2011 Author Posted April 18, 2011 By the way I did what u said ... Writing cgi.test() seems to make it work but then it also prints a lot of info. I understand that it prints something that I need to write but I dont know what ... I am doing what is normally required to be done ... any ideas on that Hey got it working .... The issue was in Python 3 the braces are important print ("Content-Type: text/html\n") Thanks a lot .... sorted everything out ... just the semantic error of braces
jje Posted April 19, 2011 Posted April 19, 2011 Glad your problem got solved. Please spare 2 minutes to leave feedback at http://www.helionet.org/index/index.php?showtopic=8947
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