[mod_python] web browser tries to download bytecode

Graham Dumpleton grahamd at dscpl.com.au
Wed Oct 19 05:21:54 EDT 2005

On 19/10/2005, at 3:16 AM, Ken Bradshaw wrote:

> Hello again,
> I've come across a weird issue. I've got a .py file on the  
> webserver that a form posts to. The first time the py file is  
> compiled to pyc, it responds correctly. The second time however  
> that the file receives a post, the web browser receives a response  
> to download the bytecode? Anyone ever had this problem before? Any  
> quick steps I can try to circumvent this annoyance?
What URL are you using? If you are using a URL which ends with
the .py extension, I can't see how it could happen. If however you
are not using the .py extension, ie., not using an extension at all,
you will be at the mercy of Apache content negotiation, which may
choose between the .py or .pyc file based on various other factors.

Thus, ensure you are using ".py" in the URL and also look at turning
off content negotiation using:

   Options -MultiViews

If this doesn't help, post the snippet of Apache configuration where
you set up PythonHandler and the action part of the HTML form so
the URL which is used can be seen.


More information about the Mod_python mailing list