[mod_python] mptest error

Roberts, Wendy wroberts at cfa.harvard.edu
Tue Aug 4 18:27:51 UTC 2015


Doh!  I had it there earlier, but somehow it went missing!

Thanks!

Wendy

On Tue, Aug 4, 2015 at 2:11 PM, Grisha Trubetskoy <grisha at modpython.org>
wrote:

> Wendy
>
> You may be missing a "from mod_python import apache" at the top of your
> script?
>
> Grisha
>
> On Tue, Aug 4, 2015 at 1:13 PM, Roberts, Wendy <wroberts at cfa.harvard.edu>
> wrote:
> > I'm trying to get the expected output from mptest, but am befuddled.  I
> > currently get this:
> >
> >> Hello World!
> >> <pre>
> >> Mod_python error: "PythonHandler mptest"
> >>
> >> Traceback (most recent call last):
> >>
> >>   File "/usr/lib64/python2.6/site-packages/mod_python/apache.py", line
> >> 398, in HandlerDispatch
> >>     result = obj(req)
> >>
> >>   File "/proj/iwebhead/www/htdocs/wtest/mptest.py", line 4, in handler
> >>     return apache.OK
> >>
> >> NameError: global name 'apache' is not defined
> >>
> >> </pre>
> >>
> > mod_python-3.5.0
> > CentOS 6.0
> > python 2.6
> > apache 2.4.12
> >
> > httpd.conf (pertinent parts):
> > LoadModule python_module      modules/mod_python.so
> > <Directory /proj/iwebhead/www/htdocs/wtest>
> >     AddHandler mod_python .py
> >     PythonHandler mptest
> >     PythonDebug On
> > </Directory>
> >
> > /proj/iwebhead/www/htdocs/wtest/mptest.py:
> > def handler(req):
> >     req.content_type = 'text/plain'
> >     req.write("Hello World!")
> >     return apache.OK
> >
> > Log file shows the same as the traceback:
> > [Tue Aug 04 12:32:08.395104 2015] [:notice] [pid 23264:tid
> 140389797328640]
> > mod_python: (Re)importing module 'mptest'
> > [Tue Aug 04 12:32:08.398235 2015] [:error] [pid 23264:tid
> 140389797328640]
> > [client 131.142.42.188:51119] PythonHandler mptest: Traceback (most
> recent
> > call last):
> > [Tue Aug 04 12:32:08.398254 2015] [:error] [pid 23264:tid
> 140389797328640]
> > [client 131.142.42.188:51119] PythonHandler mptest:   File
> > "/usr/lib64/python2.6/site-packages/mod_python/apache.py", line 398, in
> > HandlerDispatch\n    result = obj(req)
> > [Tue Aug 04 12:32:08.398265 2015] [:error] [pid 23264:tid
> 140389797328640]
> > [client 131.142.42.188:51119] PythonHandler mptest:   File
> > "/proj/iwebhead/www/htdocs/wtest/mptest.py", line 4, in handler\n
> return
> > apache.OK
> > [Tue Aug 04 12:32:08.398274 2015] [:error] [pid 23264:tid
> 140389797328640]
> > [client 131.142.42.188:51119] PythonHandler mptest: NameError: global
> name
> > 'apache' is not defined
> >
> > Any help appreciated!
> >
> > Wendy Roberts
> >
> >
> >
> > _______________________________________________
> > mod_python mailing list
> > mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.modpython.org/pipermail/mod_python/attachments/20150804/d347c8e4/attachment.html>


More information about the mod_python mailing list