Graham Dumpleton
grahamd at dscpl.com.au
Tue Mar 22 19:30:07 EST 2005
Dave Britton wrote .. > and still get this error message when I browse to > http://myserverIP/mptest.py: > (taken from the error log, from the point of server startup:) > ========= > [Tue Mar 22 23:12:41 2005] [notice] mod_python: Creating 25 session mutexes > based on 25 max processes and 0 max threads. > [Tue Mar 22 23:12:41 2005] [notice] Apache/2.0.53 (Unix) mod_python/3.1.4 > Python/2.3.3 configured -- resuming normal operations > [Tue Mar 22 23:12:41 2005] [info] Server built: Mar 16 2005 19:13:58 > [Tue Mar 22 23:12:41 2005] [debug] prefork.c(956): AcceptMutex: sysvsem > (default: sysvsem) > [Tue Mar 22 23:15:31 2005] [error] make_obcallback: could not import > mod_python.apache.\n > ======== > > What could be wrong? Are you confident that there are no other error messages in your log file that are relevant to Python/mod_python. As an experiment I removed my mod_python site packages directory and started Apache. In my log I got. [Wed Mar 23 11:12:47 2005] [notice] mod_python: Creating 32 session mutexes based on 6 max processes and 25 max threads. [Wed Mar 23 11:12:47 2005] [error] make_obcallback: could not import mod_python.apache.\n [Wed Mar 23 11:12:47 2005] [notice] Apache/2.0.51 (Unix) mod_python/3.1.4 Python/2.3 configured -- resuming normal operations What is strange here though is that the C code if the import fails is doing: if (! ((m = PyImport_ImportModule(MODULENAME)))) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, s, "make_obcallback: could not import %s.\n", MODULENAME); PyErr_Print(); } Note how it calls PyErr_Print() to dump out the actual Python error which caused the import to fail. This isn't displaying in the log though because it is logging through the Apache logging API. What is interesting though is that for my configuration and operating system, when I shutdown Apache, then the error message created by PyErr_Print() finally gets flushed and display in the error log. [Wed Mar 23 11:15:55 2005] [error] make_obcallback: could not import mod_python.apache.\n ImportError: No module named mod_python.apache ImportError: No module named mod_python.apache [Wed Mar 23 11:15:55 2005] [notice] caught SIGTERM, shutting down Note the ImportError. Thus, make sure you check throughly in your Apache error log for any other Python error messages. On your platform, depending on how it is setup, such messages may not actually got to the Apache error log, so you might also check in your general system log files in "/var/log" or otherwise as appropriate. If you can find these error messages it will give you more clues as to what is wrong. Now unfortunately, it doesn't seem to be very practical to make some call other than PyErr_Print() which logs to the Apache logging API as the internals are quite complicated. One option to try if the messages aren't getting flush when Apache is being shutdown is to run Apache as: /usr/local/apache-2.0/bin/httpd -X On my system at least, running Apache in single process mode like this results in the extra error information being flush immediately. [Wed Mar 23 11:22:15 2005] [notice] mod_python: Creating 32 session mutexes based on 6 max processes and 25 max threads. [Wed Mar 23 11:22:15 2005] [error] make_obcallback: could not import mod_python.apache.\n ImportError: No module named mod_python.apache Anyway, try and find the error messages which PyErr_Print() is generating. I'll have some code changes you can make to mod_python.c soon as well to help track down whether the search path used by Python is correct. Graham
|