I can't seem to have both my own loop running and have my program exit cleanly with CTRL-C.This is a simplified version of my code right now:cherrypy.tree.mount(mainPage(), "/")cherrypy.engine.start()while True:print 'hello world'time.sleep(5)The loop and CherryPy both work, though when I try to exit the program with CTRL-C, only my loop will stop. CherryPy will still happily serve out pages to my browser. I know I can stop CherryPy with cherrypy.engine.stop(), though I'm not sure how I use it in this specific situation.My programming experience is pretty limited, so I'm stumped right now. Any help is appreciated.--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-user...@googlegroups.com.
To post to this group, send email to cherryp...@googlegroups.com.
Visit this group at http://groups.google.com/group/cherrypy-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
I can't seem to have both my own loop running and have my program exit cleanly with CTRL-C.This is a simplified version of my code right now:cherrypy.tree.mount(mainPage(), "/")cherrypy.engine.start()while True:print 'hello world'time.sleep(5)The loop and CherryPy both work, though when I try to exit the program with CTRL-C, only my loop will stop. CherryPy will still happily serve out pages to my browser. I know I can stop CherryPy with cherrypy.engine.stop(), though I'm not sure how I use it in this specific situation.My programming experience is pretty limited, so I'm stumped right now. Any help is appreciated.--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-user...@googlegroups.com.
To post to this group, send email to cherryp...@googlegroups.com.
Visit this group at http://groups.google.com/group/cherrypy-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Use cherrypy.quickstart to make your life easieror you will need to catch the signal ctrl+c and call cherrypy.engine.stop()
On Wed, Jun 12, 2013 at 11:07 AM, <eugene.va...@gmail.com> wrote:
On 12/06/2013, at 6:50 PM, Sylvain Hellegouarch <s...@defuze.org> wrote:Could you elaborate on that?
> Publishing to the 'main' channel from your own loop is always a good idea
When you use engine.block(), the internal loop will publish to the 'main' channel every iteration. If you have a plugin subscribed to that channel, and you don't use the CherryPy's mainloop itself, e.g. no call to block(), then your plugin will never be hit. Therefore, you'd have to make sure that your own mainloop does publish to that channel. Just a call to cherrypy.engine.publish('main') would be required every iteration.
It does complain, is this anything to worry about?C:\Python27\lib\site-packages\cherrypy\process\wspbus.py:225: RuntimeWarning: The main thread is exiting, but the Bus is in the states.STOPPED state; shutting it down automatically now. You must either call bus.block() after start(), or call bus.exit() before the main thread exits."main thread exits." % self.state, RuntimeWarning)[12/Jun/2013:18:53:32] ENGINE Bus STOPPING
--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-user...@googlegroups.com.
To post to this group, send email to cherryp...@googlegroups.com.
Visit this group at http://groups.google.com/group/cherrypy-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.