[Twisted-Python] Service.stopService

Bill la Forge laforge49 at yahoo.co.in
Fri May 21 08:05:39 MDT 2004


More like copy/paste/cleanup

I've since updated things... I'm thinking that perhaps the log is shutdown.

So I'm now writing files. I get the start file, but not the stop file:

from twisted.application import service
from twisted.internet import reactor

class SimpleService(service.Service):
    def startService(self):
        service.Service.startService(self)
        reactor.addSystemEventTrigger('before','shutdown',self.stopService)
        f=open('start.txt','w')
        f.close()
    def stopService(self):
        f=open('stop.txt','w')
        f.write('KillJoy was here?')
        f.close()
        service.Service.stopService(self)
        
from twisted.application import service
from twisted.internet import reactor

import simpleService

application = service.Application('testServer')
serviceCollection=service.IServiceCollection(application)
ss=simpleService.SimpleService()
ss.setServiceParent(serviceCollection)
reactor.stop()


C:\other\Bill\compstrm\compstrm\twbsd>twistd -noy testService.py
2004/05/21 19:29 India Standard Time [-] Log opened.
2004/05/21 19:29 India Standard Time [-] twistd 1.2.0 (C:\Python23\python.exe 2.
3.3) starting up
2004/05/21 19:29 India Standard Time [-] reactor class: twisted.internet.default
.SelectReactor
2004/05/21 19:29 India Standard Time [-] Main loop terminated.
2004/05/21 19:29 India Standard Time [-] Server Shut Down.

C:\other\Bill\compstrm\compstrm\twbsd>

Now, since its working for others, let me further report that I'm running on nt2000 with twisted 1.2.

Mmm. Perhaps I'd best reinstall. I may have messed up some twisted code while adding print statements. :-O

 


Bill la Forge
http://www.geocities.com/laforge49/
Yahoo! India Matrimony: Find your partner online.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20040521/09f40a30/attachment.html>


More information about the Twisted-Python mailing list