[mod_python] ImportError: No module named linecache

Graham Dumpleton graham.dumpleton at gmail.com
Mon Jun 25 18:25:40 EDT 2007


On 26/06/07, Marty Alchin <gulopine at gamemusic.org> wrote:
> On 6/25/07, Marty Alchin <gulopine at gamemusic.org> wrote:
> > > > Might I have to recompile mod_python and specify the intended Python
> > > > installation?
> > >
> > > If you didn't explicitly compile it for the version you want to be
> > > used then perhaps. Use --with-python option as mentioned before.
> >
> > I'll give that a shot and report back. Thanks for the help.
>
> Well, I just did that this morning, making sure it was compiled
> against the right version at the right location, and I still get the
> same error. The really strange thing to me is that it can find
> traceback, but not linecache, even though they're at the same
> location.
>
> I even tried using PythonImport to try to force loading linecache in
> advance, but all that accomplished was to generate the ImportError
> each time a new process starts, as well as on each mod_python request.

Your only choice it would seem is to start instrumenting the
mod_python code with debug, ie., write out to log using
_apache.log_error() at appropriate spots. You may have to move _apache
import to first in the mod_python.apache file so you can access it and
write debug between the various imports or where ever else required.
Suggest that you try dumping out value of __file__ in modules to
determine where modules are coming from so you know they are coming
from where you think they should. Also dump out values of sys.path.
Check permissions on every directory and file in sys.path etc etc.

Graham


More information about the Mod_python mailing list