<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4611.1300" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>I had the same
configuration Apache <-> mod_python problem as a number of folks out
here.</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>I had to dig longer
than was reasonable to deduce the simple answer. Maybe I didn't look in the
right places.</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2></FONT></SPAN><SPAN
class=936375821-05102004><FONT face=Arial size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>So, with respect to
some earlier posts, yes, Patrick the manual is helpful - I'll try to be more
helpful - </FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2></FONT></SPAN><SPAN
class=936375821-05102004><FONT face=Arial size=2>></FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><STRONG>> Patrick Percot</STRONG> <A
title="[mod_python] ImportError: No module named mptest"
href="mailto:mod_python%40modpython.org?Subject=%5Bmod_python%5D%20ImportError%3A%20No%20module%20named%20mptest&In-Reply-To=1088177284.19041.6.camel%40alucard.kanux.com">ppercot
at free.fr </A><BR><I>> Fri Jun 25 18:45:48 EDT 2004</I> </SPAN></DIV>
<DIV><SPAN class=936375821-05102004>> I will answer all your
questions by the famous RTFM :)<BR><FONT face=Arial size=2>></FONT><BR><FONT
face=Arial size=2>></FONT> And the f... manual is here :<BR><FONT
face=Arial size=2>></FONT><BR><FONT face=Arial
size=2>> </FONT><A
href="http://modpython.org/live/current/doc-html/tut-what-it-do.html">
http://modpython.org/live/current/doc-html/tut-what-it-do.html</A><BR><FONT
face=Arial size=2>></FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial>></FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial>>
[....deleted..]</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial><I>> Mod_python error:
"PythonHandler mptest"<BR></I>><I> <BR></I>><I> Traceback (most recent
call last):<BR></I>><I> <BR></I>><I> File
"/usr/lib/python2.3/site-packages/mod_python/apache.py", line 181, in
Dispatch<BR></I>><I> module =
import_module(module_name, _req)<BR></I>><I> <BR></I>><I> File
"/usr/lib/python2.3/site-packages/mod_python/apache.py", line 332, in
import_module<BR></I>><I> f, p, d =
imp.find_module(parts[i], path)<BR></I>><I> <BR></I>><I> <BR></I>><I>
ImportError: No module named mptest<BR></I>><I> <BR></I></FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>Unfortunately, the
mod_python manual doesn't bother to mention the need to also extend
PYTHONPATH.</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>This is probably
obvious to Python experts.</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial
size=2></FONT> </DIV></SPAN>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>For those of you who
someday google this, and who have RTFM, but are still stuck with
the "mptest module not found" import errors, try adding something like the
following to the <Directory> entry in your Apache config
file:</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial
size=2><Directory></FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>
....</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>
AddHandler mod_python .py<BR> PythonPath "['C:/Program
Files/Apache Group/Apache2/htdocs']+sys.path"<BR>
PythonHandler mptest<BR> PythonDebug
ON<BR></Directory></FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>And stick the sample
mptest.py in the htdocs directory referred to above.</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>FWIW This is a
Windows 2000 installation - Apache 2.0.5, mod_python 3.1.3</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>For this
configuration, Apache generated errors in the system event log complaining
about too many <Directory> entries.</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial size=2>The manual glossed
over this little tidbit too, but there's a simple fix:</FONT></SPAN><SPAN
class=936375821-05102004><FONT face=Arial size=2> add the mod_python
stuff after the first <Directory> tag; don't make new
ones.</FONT></SPAN></DIV>
<DIV><SPAN class=936375821-05102004><FONT face=Arial
size=2></FONT></SPAN> </DIV></BODY></HTML>