DevRenanGaspar
DevRenanGaspar

Reputation: 373

Define python directory in cpanel

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/html\n\n"
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/html\n\n"
print "<html>Hello world!</html>"

I know python 3.6 is installed and in the specified path, as you can see below: enter image description here

WHEREIS enter image description here

Thanks.

Upvotes: 0

Views: 364

Answers (2)

DevRenanGaspar
DevRenanGaspar

Reputation: 373

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/html\n\n") print("Hello world!")

Upvotes: 0

Lucas Sierota
Lucas Sierota

Reputation: 180

#! /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.

Upvotes: 1

Related Questions