List Info

Thread: CP3.0beta & mod_python -> NameError: name '_cprequest' is not defined




CP3.0beta & mod_python -> NameError: name '_cprequest' is not defined
user name
2006-10-04 00:39:00
Dan Kvasnicka wrote:
> >
> > Sorry to make you the tester on this, but I *am*
on vacation. ;)
> >
>
> OK, I'll just describe things I've recently bumped
into, taking into
> consideration that you're on vacation ;)
>
> When using the tutorial now, I get Internal Server
Error caused by
> NameError while processing modpython_gateway:
>
> Traceback (most recent call last):
>    File
"/usr/lib/python2.4/site-packages/mod_python/apache.py&
quot;, line
> 299, in HandlerDispatchn    result = object(req)
>   File
"/usr/lib/python2.4/site-packages/modpython_gateway.py&
quot;, line
> 193, in handlern    module = __import__(module_name,
globals(),
> locals(), [''])
>  File
"/usr/lib/python2.4/site-packages/cherrypy/__init__.py&
quot;, line 88,
> in ?n   
_cprequest.Request(_http.Host("localhost", 80),
> NameError: name '_cprequest' is not defined
>
> I checked __init__ in cherrypy and _cprequest is not
imported in that
> module at all, but is used. (So it's probably not the
cause I thought
> before -- with module names duplicity)

You know, I've wondered about that before and was never
successful in
tracking it down, since it always worked even without the
import. Guess
that's biting you now. Have you tried simply importing
_cprequest
inside __init__?

> When I replace modpython_gateway by cherrypy's native
_cpmodpy, there
> is no error but I get blank screen -- the module with
my app is not
> imported at all. I checked mod_python manual and I'm
not sure about
> your usage of PythonOption in "PythonOption import
> myapp.cherrypy::startapp". I don't think this line
will result in
> importing anything. But I might be wrong.

Right; bah. I suck at docs. That's a holdover from old code.
Use
"PythonOption wsgi.startup module::func" now
instead.


Robert Brewer
System Architect
Amor Ministries
fumanchuamor.org


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

CP3.0beta & mod_python -> NameError: name '_cprequest' is not defined
user name
2006-10-04 06:44:46
So, I've got it working finally. First thing I had to do was
importing
_cprequest in __init__, so maybe someone who has the right
to commit to
cherrypy sources could fix that there.
I also changed the PythonOption the way you suggested and it
works.
However, in my case I HAVE TO provide a funcion after :: on
that line.
If I don't provide :: and write only module name,
modpython_gateway
dies on splitting the arg, because he looks for '::'. When I
keep ::
and write no func name, it dies on a quite peculiar error:

AttributeError: module '/var/www/myapp2/app.py' contains no
''

Dunno what that means exactly...

Next thing is that the 'startapp' function has to have an
argument.
What exactly is it, the request?

Next thing, you have to mount HelloWorld() to '/myapp'. When
you mount
it to '/' and point a browser to http://localhost/myapp,
you get 404.

And the last thing, with _cpmodpy I still get a blank screen
:(

Anyway, I'm glad to see we're making progress with it ;)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )