[mod_python] ImportError: No module named index

Saiello at Jentoo.com Saiello at Jentoo.com
Sun Jan 18 09:38:00 EST 2004


Sending again, correction, seems like the server ISN'T parsing the script.
Just trying to get mod_python to work on some level I have done the following, 
per the documentation:

http.conf
<Directory /python>
	AddHandler mod_python .py
	PythonHandler new
	PythonDebug On
  </Directory>

python/new.py
from mod_python import apache

def handler(req):
	req.content_type = "text/plain"
	req.write("hello world!")
	return apache.OK

When I go to http://server/python/new.py, I get a text editor with the raw 
code, so it <<CORRECTION: seems the server is parsing the script>>. Looking at 
the apache 
error_log I was seeing "[notice] mod_python: (Re)importing module 'new'", but 
now nothing is appearing in the error_log. Guess somehting is bad with my 
mod_pythong install ????

-Steven

On Sunday 18 January 2004 08:10 am, Saiello at Jentoo.com wrote:
> Alright, I changed my apache.conf per the Quick Start guide on the 3.1b
> docs to "AddHandler mod_python .py". No I get the following debug error:
>
> Mod_python error: "PythonHandler mod_python.publisher"
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 338,
> in HandlerDispatch
>     result = object(req)
>
>   File "/usr/lib/python2.2/site-packages/mod_python/publisher.py", line
> 131, in handler
>     path=[path])
>
>   File "/usr/lib/python2.2/site-packages/mod_python/apache.py", line 481,
> in import_module
>     if mtime > oldmtime:
>
> UnboundLocalError: local variable 'oldmtime' referenced before assignment
>
> On Saturday 17 January 2004 09:32 pm, you wrote:
> > http://server/python/new
> > http://server/python/new/index
> >
> > Both of the above should work in your set up. I'd try those and see if
> > there are any other clues in the error log.
> >
> > Grisha
> >
> > On Sat, 17 Jan 2004, Saiello at Jentoo.com wrote:
> > > I have tried
> > > http://server/python/new.py - brings up there error
> > > http://server/python/new - 404 error
> > > http://server/python/new.py/index - brings up error
> > > http://server/python/new/index - 404 error
> > >
> > > I saw mentioned the url issue in mailinglist archives, I upgraded my
> > > apache also.  So far no help.  My distribution is gentoo.
> > >
> > > Thanks
> > >
> > > On Saturday 17 January 2004 11:25 am, you wrote:
> > > > What's the URL you're trying to access?
> > > >
> > > > On Sat, 17 Jan 2004, Saiello at Jentoo.com wrote:
> > > > > Using:
> > > > > Apache-2.0.46
> > > > > python-2.2.3-r5
> > > > > mod_python-3.1b
> > > > >
> > > > > Apache conf:
> > > > > <Directory /home/httpd/htdocs/python>
> > > > >         SetHandler mod_python
> > > > >         PythonHandler mod_python.publisher
> > > > >         #PythonDebug On
> > > > > </Directory>
> > > > >
> > > > > new.py
> > > > > from mod_python import apache
> > > > >
> > > > > def index(req):
> > > > > 	return "Hello World!"
> > > > >
> > > > > Error_log:
> > > > > PythonHandler mod_python.publisher: ImportError: No module named
> > > > > index
> > > > >
> > > > >
> > > > > Any ideas ?
> > > > >
> > > > > _______________________________________________
> > > > > Mod_python mailing list
> > > > > Mod_python at modpython.org
> > > > > http://mailman.modpython.org/mailman/listinfo/mod_python
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list