Graham Dumpleton
grahamd at dscpl.com.au
Sun Jan 8 16:28:42 EST 2006
Fabiano Sidler wrote .. > Hi folks! > > Just come back from holidays, I wanted to run a script with > mod_python. According to the logs, mod_python was successfully loaded > and my python module is getting imported, but the browser only > receives the script code instead of its output. As usually, my > .htaccess is fine: > > SetHandler python-program > PythonHandler mymodule > PythonDebug On > > There aren't no AllowOverride statements making the above settings > fail. Can someone help me to fix this weird behaviour? > Thank you in advance! If receiving script code, presuming you are using URL ending in 'mymodule.py'. Try the following. 1. Put a file hello.txt in the same directory with something in it and try and access it using URL ending in 'hello.txt' instead of 'mymodule.py'. If it returns the contents of that file, it probably isn't using mod_python at all. 2. Introduce a syntax error in your '.htaccess' file. Ie., add a line containing just 'XXX'. If accessing anything in that directory yields a 500 error, the '.htaccess' file is at least being consulted. If you don't get a 500 error, then main Apache configuration has been changed so as to disallow you to have a '.htaccess' file. The main Apache configuration does not probably have the required: AllowOverride FileInfo for that directory. 3. Add logging in your handler code to see if it truly is being loaded and run. Ie., from mod_python import apache apache.log_error("loading module") def handler(req): apache.log_error("running handler") .... 4. Ensure that your handler is not returning apache.DECLINED, which would mean that Apache falls back to serving up static file. Ie., your source code if the URL happened to match that. 5. Read: http://www.dscpl.com.au/articles/modpython-001.html for other debugging hints and ideas. Graham
|