[mod_python] PythonPath without application path

David Siroky (net) siroky at dasir.net
Fri Apr 28 07:32:07 EDT 2006


I have an application which uses another library located in a special
directory and I used
PythonPath "['/mujbin/python_modules'] + sys.path"
to access the library for imports. Everything went well but suddenly it
stopped working:

Mod_python error: "PythonHandler apphandler"

Traceback (most recent call last):

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 287, in HandlerDispatch

  File "/usr/lib/python2.4/site-packages/mod_python/apache.py", line 454, in import_module
    f, p, d = imp.find_module(parts[i], path)

ImportError: No module named apphandler

where apphandler.py is the entry point for my application. My .htaccess
(in the same directory as apphandler.py):

SetHandler mod_python
PythonDebug On
PythonHandler apphandler
PythonAutoReload On
PythonPath "['/mujbin/python_modules'] + sys.path"

When I remove the PythonPath the apphandler is imported (but I need the
library). I printed the sys.path and now it contains the
'/mujbin/python_modules' but no more the directory with my app.

How is that possible? I guess it some stupid thing but I don't remember
changing anything that can possibly alter the behavior. I'm lost.

Thank you.


More information about the Mod_python mailing list