I am attempting to host a python script utilizing an apache web server, however the server attempts to run the script rather than just offering it for download.

I don't have immediate access to server, and adding the road

AddType text/plain .py

to .htaccess within the root folder doesn't seem to work, though I possibly could do a problem.

How do you obtain the server to simply send the file as text rather than attempting to run it?

-Edit

Altering the title doesn't work. Script.py.safe still provide a 500 Server error whenever you click it.

I ought to also point out that the .htaccess file works, but for whatever reason that certain addType lines are no longer working. Either since it is not overriding something, or even the lines are wrong.

If you cannot alter the Apache config and also you can't override it by having an htaccess file, it appears in my experience the simplest solutions could be with the idea to alter the file extension, otherwise to create a script that prints the items in the prospective script.

Both of them are hacks to some degree, however the correct option would be to alter the Apache config.

Inside your .htaccess:

RemoveHandler .py

One choice is to alter the extention making obvious that it ought to be re-named. IE python.py.safe or python.py.dl. The consumer would then have to take away the extra bit.

You might Zip up.

I'd write something which loads the python script up. By doing this you can even get energetic and can include formatting and styling from the code. You can even write it in python since you won't have precluded that by file extension.

<IfModule mime_module>
    <Files *.py>
        ForceType text/plain
    </Files>
</IfModule>

inside a .htaccess for that folder should work )