Python script read as text

Asked by:
adamcross / 11 Points
2012-09-10 9:40 pm EST
Hi. I wrote a little python script. Whenever I call it from a php script, it runs and displays output as expected. When I put it in the cgi-bin folder and browse to it in a web browser, the browser displays the text of the script. Can we fix this, please? Thanks.

note: thought this was for Web Hosting Hub support. Looks like it's "community support". Sorry about that. Why is there no option to delete this question?

To ask this user for more information, please first login.

To submit an answer, please login.

Best answer chosen by User


16,349 Points
2012-09-10 11:36 pm EST
Hello Adamcross,

The support that we provide in the Support is the same support provided by the live support. Typically coverage is around 9AM-9 for Community Support(I just happened to be looking a the questions section late this evening). Typically, when you see the browser reading the text, that means that it's identifying the file as a text file and not processing it as a script. This means that a file type definition or handler spec is required in your code. In this case, it will need to be something like this added to the .htaccess file:

Options +ExecCGI
AddHandler cgi-script .py

I believe there's another issue with your Python script (I had to change the read only permissions on it as well - from 644 to 755). I noticed that you had a ticket in for the problem. This will be the best source information for the problem. Please understand that we do not typically aid in coding issues. However, in this issue, hopefully it's simple enough that they can provide you a quick answer or point you in the right direction.

If you have any further questions, please contact technical support or leave a comment at the bottom of the page.


Arnel C.

To submit a comment on this answer, please first login.

Want to share 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!

Help Center Search

Current Customers

Email: Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

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

Not a Customer?

Get web hosting from a company that is here to help.