smetj
unread,Dec 11, 2009, 7:59:56 PM12/11/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cherrypy-users
Hi List,
When Cherrypy autoreloads because I have changed and saved the script
it keeps hanging in the loop defined at simple_test.
I though the stop method was called on simple_test when autoreloader
kicks in, but this isn't the case..
Why is that and how can I make autoreloader work as it should with
such a loop.
Here's a simplified example of my original code:
#!/usr/bin/python
import cherrypy, time
from cherrypy.process import plugins, servers
class simple_test(plugins.SimplePlugin):
def __init__(self, bus):
plugins.SimplePlugin.__init__(self, bus)
def start(self):
self.looper=True
self.bus.log("Starting the simple_test thread.")
while self.looper:
self.bus.log("Looping in the simple_test thread.")
time.sleep(5)
def stop(self):
self.looper=False
self.bus.log("Stopping the configfile monitor thread.")
self.bus.exit()
class Server:
def __init__(self):
cherrypy.engine.simple_test=simple_test(cherrypy.engine)
pass
def start(self):
cherrypy.engine.start()
cherrypy.engine.simple_test.start()
cherrypy.engine.block()
def stop(self):
cherrypy.engine.stop()
if __name__ == '__main__':
teleporter=Server()
teleporter.start()
Thanks for the help.
Smetj