Re: 回覆： Re: [Twisted-web] How to wait for a deferred object?
exarkun at divmod.com
Sun Dec 4 22:24:38 MST 2005
On Mon, 5 Dec 2005 11:52:11 +0800 (CST), Suet Lung Cheung <suetlung2003 at yahoo.com.hk> wrote:
> Thanks for your help. However it seems doesn't work. When I press Ctrl-C, it even doesn't call the stopService() function. I print a "Hello World" inside the function but it doesn't say hello to the world. And I've tried returning a Deferred from this function. However it quit before the callback is called. Can u give advice on this? Do u know where can I find some example about this? Thanks a lot.
> Snow Dragon
exarkun at boson:~$ cat > stop-service.py
from twisted.application import service
application = service.Application("stop-service demo")
exarkun at boson:~$ twistd -noy stop-service.py
2005/12/05 00:23 EST [-] Log opened.
2005/12/05 00:23 EST [-] twistd SVN-Trunk (/usr/bin/python 2.4.2) starting up
2005/12/05 00:23 EST [-] reactor class: twisted.internet.selectreactor.SelectReactor
2005/12/05 00:23 EST [-] Loading stop-service.py...
2005/12/05 00:23 EST [-] Loaded.
2005/12/05 00:23 EST [-] Received SIGINT, shutting down.
2005/12/05 00:23 EST [-] Stopping! < - - - - - - - - - stopService
2005/12/05 00:23 EST [-] Main loop terminated.
2005/12/05 00:23 EST [-] Server Shut Down.
exarkun at boson:~$
More information about the Twisted-web