• 0

Display Python files as Plain Text


Question

When I upload .py files to my website to show the source to other people, I get an error when I go to the URL.

I guess the server is trying to execute the pyton files instead of just displaying their contents as plain text.

Is there a way to make them display as plain text, possibly with .htaccess?

(I'm using GoDaddy for hosting, if that's of any importance.)

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

When I upload .py files to my website to show the source to other people, I get an error when I go to the URL.

I guess the server is trying to execute the pyton files instead of just displaying their contents as plain text.

Is there a way to make them display as plain text, possibly with .htaccess?

(I'm using GoDaddy for hosting, if that's of any importance.)

could you not just change the file extension?

im not really sure how python files work, but if you uploaded your file with .txt extension instead, would that not do the trick?

Link to comment
Share on other sites

  • 0

Make a .htaccess in the folder where you're python files are. Then put this in the .htaccess:

RemoveHandler .py

Thanks, that works perfectly :D

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.