[mod_python] Trouble with path= in apache.import_module

Damjan gdamjan at mail.net.mk
Thu Feb 17 00:11:46 EST 2005

I have a file /home/www/simpletal/tttt.py, and modpython setup to
execute a handler (irelevant but the handler is mptal.py) in a
<Directory /home/www/simpletal> config tag, so that the
/home/www/simpletal direcotry is added to the sys.path y modpython.

In my handler I try to use apache.import_module. The problem is that:

apache.import_module('tttt') # Works, but
apache.import_module('tttt', path='/home/www/simpletal') # Doesn't work!

Obviously I'd like to limit the path where the modules is searched. Is
it possible, am I doing something wrong? 

(apache-2.0.53, modpython-3.1.4, Python-2.3.4, Linux)

The exception I get is:

Mod_python error: "PythonHandler mptal"

Traceback (most recent call last):

  File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line
299, in HandlerDispatch
    result = object(req)

  File "/home/www/simpletal/mptal.py", line 60, in handler

  File "/home/www/simpletal/mptal.py", line 17, in test
    fn, ext = path.splitext(fn)

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

ImportError: No frozen submodule named /home/www/simpletal.tttt

damjan | дамјан
This is my jabber ID --> damjan at bagra.net.mk <-- not my mail address!!!

More information about the Mod_python mailing list