[mod_python] No module named _apache from inside apache

John Raines jrraines at comcast.net
Sun Sep 19 21:12:31 EDT 2004


I continue to get this error message. I've tried to adjust the path and  
to be sure permissions allow "nobody" to execute the files in question:

[Sun Sep 19 19:30:21 2004] [warn] child process 481 still did not exit,  
sending a SIGTERM
[Sun Sep 19 19:30:21 2004] [warn] child process 482 still did not exit,  
sending a SIGTERM
[Sun Sep 19 19:30:21 2004] [notice] caught SIGTERM, shutting down
[Sun Sep 19 19:30:28 2004] [notice] mod_python: Creating 32 session  
mutexes based on 6 max processes and 25 max threads.
[Sun Sep 19 19:30:28 2004] [notice] Apache/2.0.50 (Unix)  
mod_python/3.1.3 Python/2.3.3 configured -- resuming normal operations
Traceback (most recent call last):
   File "HRAStart.py", line 7, in ?
     from mod_python import apache
   File "/sw/lib/python2.3/site-packages/mod_python/apache.py", line 28,  
in ?
     import _apache
ImportError: No module named _apache
[Sun Sep 19 19:30:55 2004] [error] [client 127.0.0.1] Premature end of  
script headers: HRAStart.py, referer: http://127.0.0.1/
[Sun Sep 19 19:36:31 2004] [warn] child process 532 still did not exit,  
sending a SIGTERM
[Sun Sep 19 19:36:31 2004] [warn] child process 533 still did not exit,  
sending a SIGTERM
[Sun Sep 19 19:36:31 2004] [notice] caught SIGTERM, shutting down
[Sun Sep 19 19:36:36 2004] [notice] mod_python: Creating 32 session  
mutexes based on 6 max processes and 25 max threads.
[Sun Sep 19 19:36:36 2004] [notice] Apache/2.0.50 (Unix)  
mod_python/3.1.3 Python/2.3.3 configured -- resuming normal operations
Traceback (most recent call last):
   File "HRAStart.py", line 7, in ?
     from mod_python import apache
   File "/sw/lib/python2.3/site-packages/mod_python/apache.py", line 28,  
in ?
     import _apache
ImportError: No module named _apache
[Sun Sep 19 19:36:56 2004] [error] [client 127.0.0.1] Premature end of  
script headers: HRAStart.py, referer: http://127.0.0.1/


John-Raines-Computer:/usr/local/apache2 jrraines$ ls -l  
/sw/lib/python2.3/site-packages/mod_python
total 752
-rwxr-xr-x  1 root  admin  11698 16 Feb  2004 Cookie.py
-rwxr-xr-x  1 root  admin  13464  7 Sep 18:50 Cookie.pyc
-rwxr-xr-x  1 root  admin  10069  7 Sep 18:50 Cookie.pyo
-rwxr-xr-x  1 root  admin  11305 16 Feb  2004 Session.py
-rwxr-xr-x  1 root  admin  16155  7 Sep 18:50 Session.pyc
-rwxr-xr-x  1 root  admin  16044  7 Sep 18:50 Session.pyo
-rwxr-xr-x  1 root  admin    799 16 Feb  2004 __init__.py
-rwxr-xr-x  1 root  admin    236  7 Sep 18:50 __init__.pyc
-rwxr-xr-x  1 root  admin    236  7 Sep 18:50 __init__.pyo
-rwxr-xr-x  1 root  admin  58752  2 Sep 21:47 _psp.so
-rwxr-xr-x  1 root  admin  29856 16 Feb  2004 apache.py
-rwxr-xr-x  1 root  admin  28932  7 Sep 18:50 apache.pyc
-rwxr-xr-x  1 root  admin  27131  7 Sep 18:50 apache.pyo
-rwxr-xr-x  1 root  admin   3351 16 Feb  2004 cgihandler.py
-rwxr-xr-x  1 root  admin   2511  7 Sep 18:50 cgihandler.pyc
-rwxr-xr-x  1 root  admin   2511  7 Sep 18:50 cgihandler.pyo
-rwxr-xr-x  1 root  admin  11047 16 Feb  2004 psp.py
-rwxr-xr-x  1 root  admin  14847  7 Sep 18:50 psp.pyc
-rwxr-xr-x  1 root  admin  14727  7 Sep 18:50 psp.pyo
-rwxr-xr-x  1 root  admin   9283 16 Feb  2004 publisher.py
-rwxr-xr-x  1 root  admin   6550  7 Sep 18:50 publisher.pyc
-rwxr-xr-x  1 root  admin   6043  7 Sep 18:50 publisher.pyo
-rwxr-xr-x  1 root  admin  12397 16 Feb  2004 util.py
-rwxr-xr-x  1 root  admin  12729  7 Sep 18:50 util.pyc
-rwxr-xr-x  1 root  admin  12002  7 Sep 18:50 util.pyo


cgi-bin/HRAStart.py:
#! /sw/bin/python
#
# The line with the path to Apache was deleted
import sys
sys.path.append( '/sw/lib/python2.3/site-packages/mod_python' )
#import myinput
from mod_python import apache

PYTHONOPTIMIZE = '1'

def HRAmain (req,age,sex):
  req.write("Hello")
  return (apache.OK)

conf/httpd.conf:
LoadModule python_module modules/mod_python.so
<Directory />
     Options FollowSymLinks
     AllowOverride None
</Directory>
<Directory "/usr/local/apache2/htdocs/HTML">
   AddHandler mod_python .py
   PythonHandler HRAStart
   PythonDebug On
   PythonAutoReload On
   PythonPath "sys.path  
+['/sw/lib/python2.3/site-packages/mod_python','/usr/local/mod_python 
-3.1.3/lib/python']"
#
     Options Indexes FollowSymLinks
     AllowOverride FileInfo
     Order allow,deny
     Allow from all

</Directory>
<Directory /usr/local/apache2/cgi-bin>
     Options ExecCGI
</Directory>
#JRR
<Directory /sw/lib/python2.3/site-packages>
     Options ExecCGI
</Directory>
#JRR


John-Raines-Computer:/usr/local/apache2 jrraines$ pydoc sys.path
Help on list in sys:

sys.path = ['.', '/sw/lib/python23.zip', '/sw/lib/python2.3',  
'/sw/lib/python2.3/plat-darwin', '/sw/lib/python2.3/plat-mac',  
'/sw/lib/python2.3/pla
t-mac/lib-scriptpackages', '/sw/lib/python2.3/lib-tk',  
'/sw/lib/python2.3/lib-dynload', '/sw/lib/python2.3/site-packages']
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 4907 bytes
Desc: not available
Url : http://modpython.org/pipermail/mod_python/attachments/20040919/00b4f4e8/attachment.bin


More information about the Mod_python mailing list