This article provides essential information about using Python on A2 Hosting servers.
The correct permissions for Python script files depends on the script's particular function:
Python script files can have a .py or .cgi extension. However, as with file permissions, the file extension you use generally depends on the script's function:
To determine which Python version is the default for your server, type the following command at the command line:
python -V
The absolute path to the default Python executable on A2 Hosting's servers is /usr/bin/python. The /usr/bin directory is in the default path, however, so generally you do not need to include the full path when you run Python scripts from the command line. Just type the following command, replacing filename with the name of your script file:
python filename
There are several different versions of the Python executable available for you to use. To view the Python versions available on your server, type the following command at the command line:
ls /usr/bin/python*
For example, to run a script using Python version 3, type the following command. Replace filename with the name of your script file:
python3 filename
A2 Hosting does not support the mod_python module on shared web hosting accounts. If you have a dedicated server or VPS however, you can install and run the mod_python module.
To view the official online Python documentation, please visit http://docs.python.org.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.