[mod_python] mod_python and Python 2.3

Josh Hoyt josh at janrain.com
Fri Jan 17 15:44:09 EST 2003


Hello,

I'm trying to get mod_python working with python 2.3, and I've run into
some problems related to module importing. For some reason, it fails to
import the site module. The same setup works with Python 2.2, so I'm
pretty sure that it has something to do with the Python version and not
the configuration. Running with Python in verbose mode, the following
shows up in the apache error log file:

[...]
# trying /home/josh/scratch/python/lib/python2.3/site.py
# /home/josh/scratch/python/lib/python2.3/site.pyc matches /home/josh/scratch/python/lib/python2.3/site.py
import site # precompiled from /home/josh/scratch/python/lib/python2.3/site.pyc
[...]
'import site' failed; traceback:
ImportError: No module named site
[...]

I've attached the full error log in case there are any details there 
that I failed to make clear in the excerpts above.

This problem appears with:
Python 2.3a1, Apache 1.3.20, mod_python 2.7.6 or 2.7.8
Python 2.3a1, Apache 2.0.43, mod_python 3.0.1

It goes away with Python 2.2.2.

Any ideas about where to go from here?

Thanks,
Josh Hoyt
<josh at janrain.com>
-------------- next part --------------
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# trying /home/josh/prj/top/josh/site.so
# trying /home/josh/prj/top/josh/sitemodule.so
# trying /home/josh/prj/top/josh/site.py
# trying /home/josh/prj/top/josh/site.pyc
# trying /home/josh/prj/top/site.so
# trying /home/josh/prj/top/sitemodule.so
# trying /home/josh/prj/top/site.py
# trying /home/josh/prj/top/site.pyc
# trying /home/josh/scratch/python/lib/python23.zip/site.so
# trying /home/josh/scratch/python/lib/python23.zip/sitemodule.so
# trying /home/josh/scratch/python/lib/python23.zip/site.py
# trying /home/josh/scratch/python/lib/python23.zip/site.pyc
# trying /home/josh/scratch/python/lib/python2.3/site.so
# trying /home/josh/scratch/python/lib/python2.3/sitemodule.so
# trying /home/josh/scratch/python/lib/python2.3/site.py
# /home/josh/scratch/python/lib/python2.3/site.pyc matches /home/josh/scratch/python/lib/python2.3/site.py
import site # precompiled from /home/josh/scratch/python/lib/python2.3/site.pyc
# trying /home/josh/prj/top/josh/os.so
# trying /home/josh/prj/top/josh/osmodule.so
# trying /home/josh/prj/top/josh/os.py
# trying /home/josh/prj/top/josh/os.pyc
# trying /home/josh/prj/top/os.so
# trying /home/josh/prj/top/osmodule.so
# trying /home/josh/prj/top/os.py
# trying /home/josh/prj/top/os.pyc
# trying /home/josh/scratch/python/lib/python23.zip/os.so
# trying /home/josh/scratch/python/lib/python23.zip/osmodule.so
# trying /home/josh/scratch/python/lib/python23.zip/os.py
# trying /home/josh/scratch/python/lib/python23.zip/os.pyc
# trying /home/josh/scratch/python/lib/python2.3/os.so
# trying /home/josh/scratch/python/lib/python2.3/osmodule.so
# trying /home/josh/scratch/python/lib/python2.3/os.py
# /home/josh/scratch/python/lib/python2.3/os.pyc matches /home/josh/scratch/python/lib/python2.3/os.py
import os # precompiled from /home/josh/scratch/python/lib/python2.3/os.pyc
import posix # builtin
# trying /home/josh/prj/top/josh/posixpath.so
# trying /home/josh/prj/top/josh/posixpathmodule.so
# trying /home/josh/prj/top/josh/posixpath.py
# trying /home/josh/prj/top/josh/posixpath.pyc
# trying /home/josh/prj/top/posixpath.so
# trying /home/josh/prj/top/posixpathmodule.so
# trying /home/josh/prj/top/posixpath.py
# trying /home/josh/prj/top/posixpath.pyc
# trying /home/josh/scratch/python/lib/python23.zip/posixpath.so
# trying /home/josh/scratch/python/lib/python23.zip/posixpathmodule.so
# trying /home/josh/scratch/python/lib/python23.zip/posixpath.py
# trying /home/josh/scratch/python/lib/python23.zip/posixpath.pyc
# trying /home/josh/scratch/python/lib/python2.3/posixpath.so
# trying /home/josh/scratch/python/lib/python2.3/posixpathmodule.so
# trying /home/josh/scratch/python/lib/python2.3/posixpath.py
# /home/josh/scratch/python/lib/python2.3/posixpath.pyc matches /home/josh/scratch/python/lib/python2.3/posixpath.py
import posixpath # precompiled from /home/josh/scratch/python/lib/python2.3/posixpath.pyc
# trying /home/josh/prj/top/josh/stat.so
# trying /home/josh/prj/top/josh/statmodule.so
# trying /home/josh/prj/top/josh/stat.py
# trying /home/josh/prj/top/josh/stat.pyc
# trying /home/josh/prj/top/stat.so
# trying /home/josh/prj/top/statmodule.so
# trying /home/josh/prj/top/stat.py
# trying /home/josh/prj/top/stat.pyc
# trying /home/josh/scratch/python/lib/python23.zip/stat.so
# trying /home/josh/scratch/python/lib/python23.zip/statmodule.so
# trying /home/josh/scratch/python/lib/python23.zip/stat.py
# trying /home/josh/scratch/python/lib/python23.zip/stat.pyc
# trying /home/josh/scratch/python/lib/python2.3/stat.so
# trying /home/josh/scratch/python/lib/python2.3/statmodule.so
# trying /home/josh/scratch/python/lib/python2.3/stat.py
# /home/josh/scratch/python/lib/python2.3/stat.pyc matches /home/josh/scratch/python/lib/python2.3/stat.py
import stat # precompiled from /home/josh/scratch/python/lib/python2.3/stat.pyc
# trying /home/josh/prj/top/josh/UserDict.so
# trying /home/josh/prj/top/josh/UserDictmodule.so
# trying /home/josh/prj/top/josh/UserDict.py
# trying /home/josh/prj/top/josh/UserDict.pyc
# trying /home/josh/prj/top/UserDict.so
# trying /home/josh/prj/top/UserDictmodule.so
# trying /home/josh/prj/top/UserDict.py
# trying /home/josh/prj/top/UserDict.pyc
# trying /home/josh/scratch/python/lib/python23.zip/UserDict.so
# trying /home/josh/scratch/python/lib/python23.zip/UserDictmodule.so
# trying /home/josh/scratch/python/lib/python23.zip/UserDict.py
# trying /home/josh/scratch/python/lib/python23.zip/UserDict.pyc
# trying /home/josh/scratch/python/lib/python2.3/UserDict.so
# trying /home/josh/scratch/python/lib/python2.3/UserDictmodule.so
# trying /home/josh/scratch/python/lib/python2.3/UserDict.py
# /home/josh/scratch/python/lib/python2.3/UserDict.pyc matches /home/josh/scratch/python/lib/python2.3/UserDict.py
import UserDict # precompiled from /home/josh/scratch/python/lib/python2.3/UserDict.pyc
# trying /home/josh/prj/top/josh/copy_reg.so
# trying /home/josh/prj/top/josh/copy_regmodule.so
# trying /home/josh/prj/top/josh/copy_reg.py
# trying /home/josh/prj/top/josh/copy_reg.pyc
# trying /home/josh/prj/top/copy_reg.so
# trying /home/josh/prj/top/copy_regmodule.so
# trying /home/josh/prj/top/copy_reg.py
# trying /home/josh/prj/top/copy_reg.pyc
# trying /home/josh/scratch/python/lib/python23.zip/copy_reg.so
# trying /home/josh/scratch/python/lib/python23.zip/copy_regmodule.so
# trying /home/josh/scratch/python/lib/python23.zip/copy_reg.py
# trying /home/josh/scratch/python/lib/python23.zip/copy_reg.pyc
# trying /home/josh/scratch/python/lib/python2.3/copy_reg.so
# trying /home/josh/scratch/python/lib/python2.3/copy_regmodule.so
# trying /home/josh/scratch/python/lib/python2.3/copy_reg.py
# /home/josh/scratch/python/lib/python2.3/copy_reg.pyc matches /home/josh/scratch/python/lib/python2.3/copy_reg.py
import copy_reg # precompiled from /home/josh/scratch/python/lib/python2.3/copy_reg.pyc
# trying /home/josh/prj/top/josh/types.so
# trying /home/josh/prj/top/josh/typesmodule.so
# trying /home/josh/prj/top/josh/types.py
# trying /home/josh/prj/top/josh/types.pyc
# trying /home/josh/prj/top/types.so
# trying /home/josh/prj/top/typesmodule.so
# trying /home/josh/prj/top/types.py
# trying /home/josh/prj/top/types.pyc
# trying /home/josh/scratch/python/lib/python23.zip/types.so
# trying /home/josh/scratch/python/lib/python23.zip/typesmodule.so
# trying /home/josh/scratch/python/lib/python23.zip/types.py
# trying /home/josh/scratch/python/lib/python23.zip/types.pyc
# trying /home/josh/scratch/python/lib/python2.3/types.so
# trying /home/josh/scratch/python/lib/python2.3/typesmodule.so
# trying /home/josh/scratch/python/lib/python2.3/types.py
# /home/josh/scratch/python/lib/python2.3/types.pyc matches /home/josh/scratch/python/lib/python2.3/types.py
import types # precompiled from /home/josh/scratch/python/lib/python2.3/types.pyc
# trying /home/josh/prj/top/josh/sitecustomize.so
# trying /home/josh/prj/top/josh/sitecustomizemodule.so
# trying /home/josh/prj/top/josh/sitecustomize.py
# trying /home/josh/prj/top/josh/sitecustomize.pyc
# trying /home/josh/prj/top/sitecustomize.so
# trying /home/josh/prj/top/sitecustomizemodule.so
# trying /home/josh/prj/top/sitecustomize.py
# trying /home/josh/prj/top/sitecustomize.pyc
# trying /home/josh/scratch/python/lib/python23.zip/sitecustomize.so
# trying /home/josh/scratch/python/lib/python23.zip/sitecustomizemodule.so
# trying /home/josh/scratch/python/lib/python23.zip/sitecustomize.py
# trying /home/josh/scratch/python/lib/python23.zip/sitecustomize.pyc
# trying /home/josh/scratch/python/lib/python2.3/sitecustomize.so
# trying /home/josh/scratch/python/lib/python2.3/sitecustomizemodule.so
# trying /home/josh/scratch/python/lib/python2.3/sitecustomize.py
# trying /home/josh/scratch/python/lib/python2.3/sitecustomize.pyc
# trying /home/josh/scratch/python/lib/python2.3/plat-linux2/sitecustomize.so
# trying /home/josh/scratch/python/lib/python2.3/plat-linux2/sitecustomizemodule.so
# trying /home/josh/scratch/python/lib/python2.3/plat-linux2/sitecustomize.py
# trying /home/josh/scratch/python/lib/python2.3/plat-linux2/sitecustomize.pyc
# trying /home/josh/scratch/python/lib/python2.3/lib-tk/sitecustomize.so
# trying /home/josh/scratch/python/lib/python2.3/lib-tk/sitecustomizemodule.so
# trying /home/josh/scratch/python/lib/python2.3/lib-tk/sitecustomize.py
# trying /home/josh/scratch/python/lib/python2.3/lib-tk/sitecustomize.pyc
# trying /home/josh/scratch/python/lib/python2.3/lib-dynload/sitecustomize.so
# trying /home/josh/scratch/python/lib/python2.3/lib-dynload/sitecustomizemodule.so
# trying /home/josh/scratch/python/lib/python2.3/lib-dynload/sitecustomize.py
# trying /home/josh/scratch/python/lib/python2.3/lib-dynload/sitecustomize.pyc
# trying /home/josh/scratch/python/lib/python2.3/site-packages/sitecustomize.so
# trying /home/josh/scratch/python/lib/python2.3/site-packages/sitecustomizemodule.so
# trying /home/josh/scratch/python/lib/python2.3/site-packages/sitecustomize.py
# trying /home/josh/scratch/python/lib/python2.3/site-packages/sitecustomize.pyc
[Fri Jan 17 15:04:46 2003] [warn] pid file /home/josh/scratch/apache2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
import __builtin__ # previously loaded (__builtin__)
import sys # previously loaded (sys)
'import site' failed; traceback:
ImportError: No module named site


More information about the Mod_python mailing list