[mod_python] Import Issues

Gregory (Grisha) Trubetskoy grisha at modpython.org
Mon Apr 7 14:03:52 EST 2003


Are sure it's not a permissions problem? Httpd most likely runs as user
"nobody", so all Python libs you're using must be world-readable.

Grisha

On Mon, 7 Apr 2003, VanL wrote:

> Hello,
>
> 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
> version_check
>
> So I thought that perhaps my sys.path was bad.
> I changed the code:
> try:
>     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.2threadless
> /usr/local/lib/python2.2threadless/plat-freebsd4
> /usr/local/lib/python2.2threadless/lib-tk
> /usr/local/lib/python2.2threadless/lib-dynload
> /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
> /usr/local/webmanager/pylib/issuetracker/__init__.py
> /usr/local/webmanager/pylib/issuetracker/version_check.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.
>
> Thanks,
>
> VanL
>
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list