Help Center / Web Hosting

How to Run Python Sripts

Updated: November 20, 2022


If you wish to run Python scripts in your hosting account, you can create and edit them in cPanel.
To create and edit Python script in cPanel use the following steps:



Adding a Column


Step 1

25% Complete (success)
Cpanel Login Screen

Log into your cPanel Account.






Step 2

50% Complete (success)
File Manager

Navigate to Files and click on File Manager icon.

You can choose whether you want to run the script in the cgi-bin folder or outside of it.

The cgi-bin folder contains executable CGI scripts. If the file should be placed out of the cgi-bin folder,
.htaccess should be created additionally.

In order to run the Python script in the cgi-bin folder follow the steps:

Go to the cgi-bin folder
Create a file with a .py extension, for example pythontest.py in the /home/cPuser/public_html/cgi-bin directory
(where cPuser is your actual cPanel username).






Step 3

75% Complete (success)
Create New File

In order to create the file, click New File and specify the name of the file with the required extension and click
Create New File.




Step 4

100% Complete (success)
Change Permissions

Change the permission of the file to 0755

NOTE: Files are created with default permissions 0644. The .py file will become executable when the
permissions are changed to 0755.

In order to change the permissions of the file you need to select the file > click Change Permissions >
Mark Execute for User, Group, World columns and click Change Permissions:







Completed


Open the file, click Edit and add the code.