artavazd Posted March 10, 2016 Posted March 10, 2016 I cannot run Python scripts on HelioHost at my URL http://benesolutions.heliohost.org/cgi-bin/test.py. It is a simplest script with the following content: #!/usr/bin/python print("Content-type: text/html\n\n")print("This is a Python script text.") Permissions are 0755, as recommended. The server response was Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.Please contact the server administrator, webmaster@benesolutions.heliohost.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.More information about this error may be available in the server error log.Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Could you clarify please what I’m doing wrong.
Byron Posted March 11, 2016 Posted March 11, 2016 Go to your cpanel's file manager and edit your file. Change your shebang line to look like this: #!/usr/bin/env python Then save the changes with us-ascii as the encoding. http://dallas.heliohost.org/cgi-bin/python.py
Byron Posted March 11, 2016 Posted March 11, 2016 This describes why python throws an error when you edit with Windows: http://sqlblog.com/blogs/jamie_thomson/archive/2012/08/07/replacing-crlf-with-lf-using-notepad.aspx If you use Notepad++, edit your files in Unix format. Quoted from page above. Another option is to go to Edit -> EOL Conversion -> Unix Format
artavazd Posted March 11, 2016 Author Posted March 11, 2016 Thank you very much - now it works. Never could imagine that Python is so sensitive to EOLs. I've a project with tens of files, all prepared in Windows - it seems, I've to convert all of them. However, thanks again, the advice was really helpful.
artavazd Posted March 14, 2016 Author Posted March 14, 2016 I'm sorry, but I've another issue now. As it was pointed on your Website, I can use Python 3.2 (http://www.heliohost.org/home/features/languages/python). Currently it is version 2.43. How could I switch to that Python 3.2? I'm asking because (I'm sure you know that even better then me) there is a lot of differences between those Python versions.
wolstech Posted March 14, 2016 Posted March 14, 2016 I see Python 2.4, 2.7, and 3.4 on Johnny... If you want 3.4, try using this for the shebang line:#!/usr/local/bin/python3.4
artavazd Posted March 14, 2016 Author Posted March 14, 2016 Thank you very much - your're really very kind and supportive.
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