[mod_python] erratic behaviour from mptest.py

John Riehl jcriehl at mail.jpl.nasa.gov
Tue Jul 6 09:59:44 EDT 2004

I set up a textbook mptest.py "hello world" example. Sometimes it works,
sometimes it gives me this:

Mod_python error: "PythonHandler mptest"

Traceback (most recent call last):

    File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line
287, in HandlerDispatch

    File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line
457, in import_module
      module = imp.load_module(mname, f, p, d)

    File "/proj/simdev/www/modpython/mptest.py", line 1

      from mod_python import apache


SyntaxError: invalid syntax


(---- are mine to delimit sections)

To add to this, I created a second mptest.py, in a different location,
which works all the time.  (hello world).

The flakey mptest.py is under the user's directories.  The consistently
correct one is under the apache document root, symlinked from the user
directories (dont want to run this way).

The flakey one seems to run correctly if I had just previously run the
consistently correct one, or if it had just run correctly.  If I wait a
couple of minutes, and then run it, it will give me the error.

Anyone seen this before?  Any insight to resolving this?

I have been reading the archives, and someone suggested replacing the
PythonDebug On with
	<Files *>
                  PythonPath "sys.path + ['/<pathname>/modpython']"
                  PythonDebug On
but that has not yielded any additional error information.

apache error log has the same errors as above in it.

mod_python is 3.1.3, apache is 2.0.49, and python is 2.2 (rpm:
python-2.2.2-26).  apache & mod_python were built from source, python is
via rpm.

Thanks in advance,

john riehl
sysadmin/mission systems engineer
multi-mission information systems testbed
jet propulsion laboratory

More information about the Mod_python mailing list