[mod_python] Import Error puzzle

Oleksandr Moskalenko malex at purdue.edu
Thu Jan 31 01:38:03 EST 2002


 Hello all,

I'm really puzzled by this problem. I have two identical configurations
on two pretty much identical Debian GNU/Linux Unstable systems. Both use
python 2.1 + mod_python 2.7.6. Mod_python works fine on one of those,
but on the other it produces the following error:

Mod_python error: "PythonHandler mptest"

Traceback (most recent call last):

  File "/usr/lib/python2.1/site-packages/mod_python/apache.py", line
181, in Dispatch
    module = import_module(module_name, _req)

  File "/usr/lib/python2.1/site-packages/mod_python/apache.py", line
335, in import_module
    f, p, d = imp.find_module(parts[i], path)

ImportError: No module named mptest



Now as far as I understand mod_python adds the current directory to the
front of the sys.path and then imports module by name. What could go
wrong here? Regular python cgi scripts work fine. I can successfully run
the following, for example:
#!/usr/bin/env python

print 'Content-Type: text/html'
print
print '<html>'
print ' <head>'
print '  <title>My CGI application</title>'
print ' </head>'
print ' <body>'
print '  Hello from my simple CGI application!'
print ' </body>'
print '</html>'

and get the Hello... string

Can anybody help me troubleshoot this?


Thank you,

Alex.

-----------------------
Oleksandr Moskalenko
malex at purdue.edu
-----------------------
pub  1024D/6C5F196B 2001-08-17 /* http://www.tagancha.org/pgp */
Oleksandr V. Moskalenko (Alex) <malex at tagancha.org>
Fingerprint = EE63 C471 ADBA 5D80 ADFB  1054 DA28 6F32 6C5F 196B
----------------------------------------------------------------



More information about the Mod_python mailing list