[mod_python] ImportError: No module named linecache

Graham Dumpleton graham.dumpleton at gmail.com
Sun Jun 24 19:49:19 EDT 2007


If you do have multiple Python versions, read:

  https://issues.apache.org/jira/browse/MODPYTHON-225

Also run the command line python executable for the version you expect
to be able to use and go:

  import mod_python

If it doesn't find the module, then Python component parts of
mod_python not installed for that version.

Graham

On 25/06/07, Jim Gallacher <jpg at jgassociates.ca> wrote:
> Hi Marty,
>
> Any chance you have multiple versions of python installed?
>
> If so make sure the correct python is listed first in your PATH in the
> context of the user that runs apache.
>
> Jim
>
> Marty Alchin wrote:
> > Hello all,
> >
> > This is my first time venturing into the world of mod_python, and I'm
> > having a bit of trouble getting it working. I'm trying to use it with
> > Django and with Trac, but both have the same problem, so it seems like
> > it's something with my mod_python setup in general.
> >
> > Apache starts fine, but when I try to view either of the sites I set
> > up with mod_python, I get a generic Internal Server Error, with the
> > following in error_log:
> >
> > [Sun Jun 24 10:55:16 2007] [error] make_obcallback: could not import
> > mod_python.apache.\n
> > Traceback (most recent call last):
> >  File "/usr/local/lib/python2.4/site-packages/mod_python/apache.py",
> > line 21, in ?
> >    import traceback
> >  File "/usr/local/lib/python2.4/traceback.py", line 3, in ?
> >    import linecache
> > ImportError: No module named linecache
> > [Sun Jun 24 10:55:16 2007] [error] make_obcallback: Python path being
> > used "['/usr/local/lib/python2.4/site-packages/setuptools-0.6c1-py2.4.egg',
> > '/usr/local/lib/python2.4/site-packages/Django-0.95-py2.4.egg',
> > '/usr/local/lib/python24.zip', '/usr/local/lib/python2.4',
> > '/usr/local/lib/python2.4/plat-linux2',
> > '/usr/local/lib/python2.4/lib-tk',
> > '/usr/local/lib/python2.4/lib-dynload',
> > '/usr/local/lib/python2.4/site-packages']".
> > [Sun Jun 24 10:55:16 2007] [error] get_interpreter: no interpreter
> > callback found.
> >
> > But when I load up python interactively, it works just fine, loading
> > both traceback and linecache individually:
> >
> >>>> import traceback
> >>>> import linecache
> >>>>
> >
> > I tried the post-install troubleshooting step[1] to provide additional
> > information, but accessing that URL results in the same error listed
> > above.
> >
> > As this is my first foray into mod_python, I can't quite figure out
> > what I'm doing wrong. Below is as much background information as I
> > could think to include.
> >
> > Apache:
> > # /usr/local/apache2/bin/httpd -v
> > Server version: Apache/2.2.2
> > Server built:   May 12 2007 21:31:02
> >
> > Mod_python:
> >>>> import mod_python
> >>>> mod_python.version
> > '3.3.1'
> >
> > Python:
> > # python -V
> > Python 2.4.3
> >
> > VirtualHost config:
> > <VirtualHost *:80>
> > ServerName dev.mysite.com
> > PythonPath "['/path/to/project'] + sys.path"
> > SetHandler python-program
> > PythonHandler django.core.handlers.modpython
> > SetEnv DJANGO_SETTINGS_MODULE mysite.settings
> > PythonDebug On
> >
> > <Location /trac>
> > SetHandler mod_python
> > PythonHandler trac.web.modpython_frontend
> > PythonOption TracEnv /path/to/env
> > PythonOption TracUriRoot /trac
> > </Location>
> > </VirtualHost>
> >
> > -Gul
> >
> > [1]
> > http://www.modpython.org/live/mod_python-3.3.1/doc-html/inst-trouble.html
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list