Where to put Python scripts?

Category: Python

amosglenn
Asked:
2012-12-10 10:35 am EST

Hits: 1,278
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.

Thanks,
Amos

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

0

jamesr
Staff
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.

yourdomain.com/cgi-bion/test.py

This is the code we used:

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

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.

Like this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

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: support@InMotionHosting.com
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!