[mod_python] mod_python claims it cannot find a module

Martin MOKREJŠ mmokrejs at ribosome.natur.cuni.cz
Mon Jul 4 10:24:56 EDT 2005


Hi,
  when I have in httpd.conf:

<IfDefine PYTHON>
  <IfModule !mod_python.c>
    LoadModule python_module    modules/mod_python.so
  </IfModule>
</IfDefine>

<IfModule mod_python.c>

AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonInterpPerDirectory On
PythonDebug On


and no .htaccess in my public_html directory and access
http://aquarius/~mmokrejs/IRES2/IRESite_web.py?page=all, I get:


Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

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

  File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 187, in handler
    module = page_cache[req]

  File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line 77, in __getitem__
    return self._checkitem(name)[2]

  File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line 118, in _checkitem
    opened = self.check(key, name, entry)

  File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 67, in check
    return ModuleCache.check(self, key, req, entry)

  File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line 249, in check
    opened = file(key, self.mode)

IOError: [Errno 2] No such file or directory: '/home/mmokrejs/public_html/IRES2/index.py'


But, when I create .htaccess with:

AddHandler mod_python .py
PythonHandler mod_python.publisher
PythonInterpPerDirectory On
PythonDebug On

it works.

index.py really doesn't exist. I get rid of this stupid error when .htaccess
contains only:

<IfModule mod_dir.c>
    DirectoryIndex IRESite_web.py
</IfModule>




But then it complains about another module on line 1 in the source file:

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

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

  File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 187, in handler
    module = page_cache[req]

  File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line 77, in __getitem__
    return self._checkitem(name)[2]

  File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line 119, in _checkitem
    value = self.build(key, name, opened, entry)

  File "/usr/lib/python2.4/site-packages/mod_python/publisher.py", line 77, in build
    return ModuleCache.build(self, key, req, opened, entry)

  File "/usr/lib/python2.4/site-packages/mod_python/cache.py", line 369, in build
    exec opened in module.__dict__

  File "/home/mmokrejs/public_html/IRES2/IRESite_web.py", line 1, in ?
    import web_settings

ImportError: No module named web_settings





The errors changed, however from 
IOError: [Errno 2] No such file or directory: '/home/mmokrejs/public_html/IRES2/index.py'
to
ImportError: No module named web_settings


Why does it happen? I use at the moment http://cvs.apache.org/snapshots/mod_python/mod_python_20050704111017.tar.gz
under apache-2.0.54.


Martin


More information about the Mod_python mailing list