mod_python/'import site' failed

Stephan Effelsberg b012414 at mail.dvz.fh-koeln.de
Thu Jan 18 06:47:58 EST 2001


Martin Sandin schrieb:

> Hello!
>
> I'm trying to get mod_python up running and have run into the same problem
> on both Win98 systems I've attempted this feat on. This after following the
> instruction provided to the best of my abilities. Apache starts giving the
> following message:
>
> 'import site' failed; use -v for traceback
> Apache/1.3.12 (Win32) mod_python/2.6.3 Python/2.0 running...
> 'import site' failed; use -v for traceback
>
> and then returning "internal server error" on the URLs pointing to Python
> files. Now, I'd be asking this on the mod_python mailing list if it wasn't
> for the fact that I've tracked dow that error message as something that
> Python emitts. Thus given I'll ask this:
>
> What does that error message mean? What has gone wrong? How can I fix it in
> general? And if anyone knows, how can it be fixed in this particular case?
>

Apart from 'ordinary' modules, site.py is a very special module for handling
OS-specific imports of 3rd party modules (e.g. look if you have *.pth files in
your Python directory, they are read by this module) and adjusting sys.path, it
is imported automatically during startup.
A failed import of this module also causes this special error message, not the
usual ImportError. It seems that you either don't have the file site.py (or
site.pyc) or Python is not able to locate it.
A failed import of 'site' is no reason for Python to quit, you're simply not
able to locate some specific modules. That's the reason why Apache tells you
that Python is running, because it is really doing so.
Conclusion: either Python is not installed correctly or Apache is able to
modify the way Python works (but don't ask me how in particular, I'm not an
Apache expert).





More information about the Python-list mailing list