[mod_python] problems finding module

Vincent J. Buonassisi vjb at vuit.com
Wed Apr 23 20:25:32 EST 2003


hi,

i am having problems in getting mod_python to run the following simple 
script in apache:

	import sys

	from WVWService.util import XMLUtil

	from mod_python import apache

	def handler(req):

    	 path = str(sys.path)
    	 print path
    	 req.content_type = "text/plain"
    	 req.send_http_header()
     	req.write(path)

     	return apache.OK

	if __name__ == "__main__":
   	  print sys.path

with the followig entry in apache's httpd.conf file:

	<Directory /var/www/html>
   	    AddHandler python-program .py
    	    PythonHandler myscript
	    PythonPath
		"sys.path+['/home/vjb/workspace/wvwBase3/src/wvw']"
    	    PythonDebug On
	</Directory>


i get the following error in my web browser:


Mod_python error: "PythonHandler myscript"

Traceback (most recent call last):

   File "/usr/local/lib/python2.2/site-packages/mod_python/apache.py", 
line 320, in HandlerDispatch
     module = import_module(module_name, config)

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

ImportError: No module named myscript


if i comment the PythonPath line the i get the error:

ImportError: No module named WVWService.util


can someone please tell me what i am doing wrong?

thanks,

vince



More information about the Mod_python mailing list