[mod_python] ImportError: No module named linecache

Graham Dumpleton graham.dumpleton at gmail.com
Mon Jun 25 21:32:17 EDT 2007


On 26/06/07, Marty Alchin <gulopine at gamemusic.org> wrote:
> On 6/25/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> > 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.
>
> Well, I decided to try this out, and I seem to be even more confused
> than before. After editing mod_python's apache.py, the same error came
> up, with the same line numbers, and without my debugging information.
> Initially I thought it was just blindly using the pyc or pyo files
> without recompiling from source, so I moved both of them to have a
> non-Python location, and it's still using the file as it originally
> shipped.
>
> Am I missing something here? Does this somehow get compiled in somewhere else?

Are you installing that version then doing a full stop/start (not a
restart or graceful) of Apache.

Can you rebuild mod_python against the standard OS supplied version of
Python in /usr/bin and ignore your version in /usr/local/bin and see
if that works. Ensure that /usr/local/bin is not in PATH of Apache.
Half the time these strange sorts of problems are because of using a
Python not installed in standard location, so would be good to see if
it works with the one in the standard location or not.

Graham


More information about the Mod_python mailing list