stburns wrote:
> Created following "hello" package in
sys.path:
>
> D:devpythonhello> cat __init__.py
> import cherrypy
> class HelloWorld:
> cherrypy.expose
> def index(self):
> return "Hello world!"
> cherrypy.tree.mount(HelloWorld())
> cherrypy.server.quickstart()
> cherrypy.engine.start()
>
> D:devpythonhello> ls -l
> drwx------+ 2 0 Nov 2 12:21 .
> d---------+ 6 0 Nov 2 10:28 ..
> -rwx------ 1 278 Nov 2 12:21 __init__.py
> -rwx------ 1 211 Nov 2 12:21 __init__.pyc
>
> It runs fine executed as a module:
> ...
> But running as a package (D:devpython is in sys.path)
there is no
> response on 8080 and Ctrl-C causes console window to
lockup while
> shutting down app engine:
>
> D:devpythonhello> python -c "import
hello"
> [02/Nov/2006:12:58:13] HTTP Serving HTTP on http://localhost:8080/
> [02/Nov/2006:12:58:56] ENGINE <Ctrl-C> hit:
shutting down app engine
>
> Are there any caveats to package structuring a CherryPy
app?
No, but there are caveats to running endless loops at the
top level of a
module on import. engine.start() starts an infinite loop;
when this
happens during an import, the module-instantiation code
never gets a
chance to complete. To "run it as a package", the
correct syntax is:
> D:devpythonhello> python __init__.py
Robert Brewer
System Architect
Amor Ministries
fumanchu amor.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-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---
|