[mod_python] Trying to get new importer working

Graham Dumpleton graham.dumpleton at gmail.com
Wed Apr 9 01:51:35 EDT 2008


See:

  http://www.modpython.org/live/current/doc-html/app-changes-from-3.2.10.html

In particular:

  (MODPYTHON-143)

The heading means these are the changes made since 3.2.10, which in
this case means 3.3 versions.

In some respects the heading could be clearer as to what it means.

But then, in:

  http://www.modpython.org/live/current/doc-html/pyapi-apmeth.html

It quite clearly says it was only introduced in 3.3. And that
documentation for import_module() function is effectively the new
importer documentation.

Graham

2008/4/9 Jim Geist <jimge at rodentia.net>:
> Yes this is 3.2. I thought I read that the new importer was in any 3.x
> version, is that incorrect?
>
>  Thanks!
>
>
>
>  On Apr 8, 2008, at 10:29 PM, Graham Dumpleton wrote:
>
>
> > You aren't using mod_python 3.3.1 but some older version.
> >
> > Graham
> >
> > 2008/4/9 Jim Geist <jimge at rodentia.net>:
> >
> > >
> > > On Apr 8, 2008, at 10:11 PM, Graham Dumpleton wrote:
> > >
> > >
> > >
> > > > 2008/4/9 Jim Geist <jimge at rodentia.net>:
> > > >
> > > >
> > > > > Hi all -
> > > > >
> > > > > I am trying to convert my project over from using sys.path to use
> the
> > > > >
> > > >
> > > new
> > >
> > > >
> > > > > importer and I'm having some issues. In my apache config I have this
> > > > >
> > > > > <Location /test>
> > > > >  SetHandler mod_python
> > > > >  PythonOption mod_python.importer.path "['/home/jimge/app']"
> > > > >  PythonHandler entry
> > > > >  PythonDebug On
> > > > > </Location>
> > > > >
> > > > > /home/jimge/app/entry.py contains (well, more code, but it boils
> down
> > > > >
> > > >
> > > to)
> > >
> > > >
> > > > >
> > > > > from mod_python import apache
> > > > > def handler(req):
> > > > >  req.write("hello, world!\n")
> > > > >  return apache.OK
> > > > >
> > > > > When I was using PythonPath to set up sys.path everything worked.
> With
> > > > >
> > > >
> > > this
> > >
> > > >
> > > > > setup I get an ImportError exception that entry cannot be found.
> > > > >
> > > > > Anyone have any hints?
> > > > >
> > > > >
> > > >
> > > > Please post the complete Python exception message and any other logged
> > > > messages associated with it form the Apache error log and/or web page.
> > > > It will save us guessing.
> > > >
> > > > Graham
> > > >
> > > >
> > >
> > > Sure. Here's the traceback from the browser:
> > >
> > > Mod_python error: "PythonHandler entry"
> > >
> > > Traceback (most recent call last):
> > >
> > >  File "/usr/lib/python2.5/site-packages/mod_python/apache.py", line 287,
> in
> > > HandlerDispatch
> > >   log=debug)
> > >
> > >  File "/usr/lib/python2.5/site-packages/mod_python/apache.py", line 461,
> in
> > > import_module
> > >   f, p, d = imp.find_module(parts[i], path)
> > >
> > > ImportError: No module named entry
> > >
> > > In the Apache error log:
> > >
> > > [Wed Apr 02 05:26:09 2008] [notice] mod_python: (Re)importing module
> > > 'entry'
> > > [Wed Apr 02 05:26:09 2008] [error] [client 10.211.55.2] PythonHandler
> > > entry: Traceback (most recent call last):
> > > [Wed Apr 02 05:26:09 2008] [error] [client 10.211.55.2] PythonHandler
> > > entry:   File "/usr/lib/python2.5/site-packages/mod_python/apache.py",
> line
> > > 287, in HandlerDispatch\n    log=debug)
> > > [Wed Apr 02 05:26:09 2008] [error] [client 10.211.55.2] PythonHandler
> > > entry:   File "/usr/lib/python2.5/site-packages/mod_python/apache.py",
> line
> > > 461, in import_module\n    f, p, d = imp.find_module(parts[i], path)
> > > [Wed Apr 02 05:26:09 2008] [error] [client 10.211.55.2] PythonHandler
> > > entry: ImportError: No module named entry
> > >
> > >
> > >
> > > -- Jim
> > >
> > >
> > > _______________________________________________
> > > 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