[mod_python] Import Issues

VanL vlindberg at verio.net
Mon Apr 7 10:38:41 EST 2003


I am probably being just dense, but I cannot get my modules to import 
under mod_python.

I can do it fine at the command line:

 >>> from issuetracker import version_check

However, mod_python complains:

[Mon Apr  7 16:27:46 2003] [error] PythonHandler mod_python.cgihandler: 
Traceback (most recent call last):
[]   File "/usr/local/lib/python2.2/site-packages/mod_python/apache.py", 
line 193, in Dispatch
    result = object(req)
[] PythonHandler mod_python.cgihandler:   File 
"/usr/local/lib/python2.2/site-packages/mod_python/cgihandler.py", line 
122, in handler
    imp.load_module(module_name, fd, path, desc)
[] PythonHandler mod_python.cgihandler:   File 
"/usr/local/webmanager/controlpanel/support/issuetracker.py", line 31, in ?
    from issuetracker import version_check
[] PythonHandler mod_python.cgihandler: ImportError: cannot import name 

So I thought that perhaps my sys.path was bad.
I changed the code:
    from issuetracker import version_check
except ImportError:
    raise ImportError(' '.join(sys.path))

Still an error:
[top levels snipped]
[] PythonHandler mod_python.cgihandler: ImportError: 
/usr/local/lib/python2.2/site-packages /usr/local/webmanager 
/usr/local/webmanager/pylib /usr/local/webmanager/pylib/Packages

issuetracker is a package under /usr/local/webmanager/pylib:
# ls /usr/local/webmanager/pylib/issuetracker/*.py

I have been able to get other modules to import, and I can import 
issuetracker (top-level only) with no problems.  Anyone have a clue?

Apache 1.3.26, mod_python 2.78, python2.2-threadless.



More information about the Mod_python mailing list