My Cpanel host has 2 instances of Python.
Python 2.6 – /usr/bin/python
Python 3.6 – /usr/bin/python3.6
If I run this script:
#! /usr/bin/python
print "Content-type: text/htmlnn"
print "<html>Hello world!</html>"
It works!
But If it doesn’t work (Internal error 500) if I run:
#! /usr/bin/python3.6
print "Content-type: text/htmlnn"
print "<html>Hello world!</html>"
I know python 3.6 is installed and in the specified path, as you can see below:
Thanks.
2
Answers
The problem seems to be the missing parentheses in the print function, it was python2 style and it was causing a 500 internal error.
I changed to: print("Content-type: text/htmlnn") print("Hello world!")
#! /usr/bin/python
is a shebang line.A shebang line defines where the interpreter is located. In this case, the
python3
interpreter is located in/usr/bin/python3
.You may try using
#!/usr/bin/python3
instead of#! /usr/bin/python3.6
.