[mod_python] Error: Could not import mod_python.apache

Dietrich Epp dietrich at zdome.net
Sun Feb 8 23:43:48 EST 2004


Hmm... this time I'll try sending the reply to the LIST, as opposed to 
just myself.

Okay, it's been almost 48 hours and the response has been dead except 
for a single person telling me that they had the same problem.  That's 
cool.  I rewrote the error handling for the section of mod_python that 
failed and got a much more descriptive message.  I replaced the 
occurrences of \n with newlines.  It appears to be cut off by Python at 
(2^9)-1 characters after "ImportError: ".

[error] mod_python: ImportError: Failure linking new module: : dyld: 
/usr/local/apache/bin/httpd Undefined symbols:
/usr/local/python/lib/python2.3/lib-dynload/time.so undefined reference 
to _PyArg_Parse expected to be defined in the executable
/usr/local/python/lib/python2.3/lib-dynload/time.so undefined reference 
to _PyArg_ParseTuple expected to be defined in the executable
/usr/local/python/lib/python2.3/lib-dynload/time.so undefined reference 
to _PyDict_GetItemString expected to be defined in the executable
/usr/local/python/lib/pytho

This leaves me with some questions.

0. Why does mod_python call PyErr_Print?  The output goes nowhere, as 
far as I can tell, even if httpd is launched with -X.

1. Does this mean that python's dynamically-linked modules only look in 
the linking application namespace to find symbols expected to be found 
in Python?

2. Could I fix this by relinking Python with a single level namespace 
(this is specific to Mac OS X)?  This seems to be a bad solution, as I 
don't think the problem is OS X-specific.

3. Could I fix this by changing in a more general (i.e., 
cross-platform) way the method that Python's libraries search for their 
dependencies?  Can this be done without moving Python's core code to a 
dynamic library?

4. Have other projects had the same problem when embedding Python in 
dynamically loaded object code?

5. Are there even any other projects which embed Python in dynamically 
loaded object code?

6. Am I posting on the wrong list?

On Feb 7, 2004, at 3:21 AM, Dietrich Epp wrote:

> I've spent a while searching the list archives for a solution to the 
> problem:
>
> make_obcallback: could not import mod_python.apache.
>
> I'm running Apache 2.0 and mod_python from CVS.  Python is installed 
> in a funny place, /usr/local/python.  According to my research, I have 
> to do something to tell apache/mod_python Python's location.  Is that 
> correct?  How do I do this?  I've seen a decent number of messages on 
> this topic, but very few answers, and none that are definitive.
>
> Since I'm doing the tutorial in the docs, I see no need to post my 
> httpd.conf sections here.



More information about the Mod_python mailing list