Python scripts can be ran on our servers within your cgi-bin folder. In this article, we'll show you how to setup a basic 'Hello World' python script.
1. The first thing you'll need to do is create hello_world_python.py. Using either the File Manager (of use ftp), create a file named hello_world_python.py. This file should be created in your cgi-bin folder.
2. Edit the hello_world_python.py file and input the following code:
3. After saving the file, change the permission of hello_world_python.py to 755. Within the File Manager, you can do this by right-clicking on the file and choosing "Change Permissions". Then, set the values to 755.
4. After updating file's permissions, visit yourdomain.com/cgi-bin/hello_world_python.py in your browser. You should see "Hello World" printed to the screen!
n/a Points
|
2014-11-20 12:21 pm
I'm trying to install addon libraries for Python onto the server, but I'm not really sure how to go about it. I've set up a .bashrc file in the root folder, and put the libraries into .local/lib/site-packages, but my cron job doesn't seem to find the libraries. Any help? |
Staff 12,339 Points
|
2014-11-20 11:20 pm
Hello Simon,
Thank you for contacting us. Since this is a shared server environment, you will not be able to install python libraries. Python is installed on our servers however, so you should be able to use existing libraries. The path is: /usr/bin/python Thank you, John-Paul |
n/a Points
|
2015-05-12 3:03 am
Hello,Is there a list of libraries that you have available for immediate use?Thanks,Kevin |
Staff 1,198 Points
|
2015-05-12 3:30 pm
Hello Kevin,
We do not hold a list of libraries but we may write an article in the future with that list to help other developers as well. Best Regards, TJ Edens |
n/a Points
|
2018-03-07 8:27 pm
I get Error 500 when I try to run this Hello World example on my webhostinghub account. Does this no longer work? |
Staff 17,314 Points
|
2018-03-07 10:07 pm
Hello,
I just checked the script by following the steps above and it worked. Make sure you change the permissions. It should definitely still work. |
n/a Points
|
2018-03-08 9:07 pm
I got it to work. I had the permissions set to 777, not 755, which I thought should work fine since it's a higher level of access, but apparently not. For future users: you can't enter the permission code directly in the File Manager, you have to check/uncheck certain boxes; 755 corresponds to User=read+write+execute, Group=read+execute, World=read+execute. |
Staff 12,339 Points
|
2018-03-08 9:29 pm
Yes, 777 permission would be a security risk since anyone can write to and execute the script.
Thank you, John-Paul |
Email: | support@WebHostingHub.com | Ticket: | Submit a Support Ticket |
---|---|---|---|
Call: |
877-595-4HUB (4482) 757-416-6627 (Intl.) |
Chat: | Click To Chat Now |
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!