InMotion Hosting Support Center

Where to put Python scripts?

Category: Python

2012-12-10 10:35 am EST

Hits: 1,707
I'm just getting started working in Python, and I'm not yet able to have the server run a python script. I've pretty much only tried putting the script in the cgi-bin directory. I'm not sure what to do next.


You must login before you can ask a follow up question.

You must login before you can submit an answer.

Best answer chosen by User


5,889 Points
2012-12-10 11:54 am EST
Thank you for your question Amos!

Python scripts do need to be in the cgi-bin folder. Also, you will need the permissions to be 775 or 755 and not 777. 777 can cause internal server errors. We created a test script in your cgi-bin to show the .py working. Please check the following.

This is the code we used:

#!/usr/bin/env python
print "Content-Type: text/html"
print """\
<title>Python - Hello World</title>
Hello World

Unfortunately, from looking at the code you are trying to run, we are not able to determine why your .py is not running. Sorry for this. Unfortunately we do not have any knowledge base on this specific code.

Best regards,
James R

You must login before you can post a comment about this answer.

Is running python scripts only for VPS and dedicated servers? or can my business account run the python scripts as well? my script:
does not run.
thank you,
20 Points
2015-02-24 1:43 pm EST



5,833 Points
2015-02-24 11:06 pm EST

I went to and it does seem to work, below is what I was introduced with.

This is a test

Hello World once more

Best Regards,
TJ Edens

You must login before you can post a comment about this answer.

I was talking to support last night and this is what we figured out:
You need to make sure you follow the instructions at:

and place the line
AddHandler cgi-script .cgi .pl .py
on the top of your .htaccess file in the publicHTTP folder.
Then in order to make the script run you need to make sure you are uploading the file as ascii and not binary. Binary is what is default on FileZilla, so you need to change that under edit/settings/transfers/filetypes.
May I ask though, why has Inmotion stayed with a version of python that is almost 10 years old? In later versions of python, I don't think this is a problem.
Also, it would be amazing if django could be an option for shared hosts to use.
20 Points
2015-02-25 2:50 am EST
Hello Frastlin,

I'm not familiar with the version of Python that is on the server. Generally, what is there is what is available through cPanel. If there is another, then they typically update it. However, I will check on the version of Python available for customer use and post a response when I have the information.

Kindest regards,
Arnel C.
27,085 Points
2015-02-26 9:11 am EST
Like this Question?

Support Center Login

Social Media Login

Social Login Joomla

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!