[Twisted-Python] still no stop!

Christopher Armstrong radix at twistedmatrix.com
Fri May 21 08:27:13 MDT 2004


Bill la Forge wrote:
> I've uninstalled twisted and re-installed.
>  
> Still no 'stop'! Here's my latest (true) test:
>  
> from twisted.application import service
> from twisted.internet import reactor
> class SimpleService(service.Service):
>     def startService(self):
>         service.Service.startService(self)
>         print '>>>start'
>     def stopService(self):
>         print '>>>stop'
>         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()

Get rid of 'reactor.stop()'. I expect you misunderstood when exactly the 
.tac file is being executed; it happens before the reactor is started, 
so you're trying to stop the reactor before it starts, which is screwing 
things up. Just get rid of the reactor.stop(), run it as you were and 
hit ctrl-C; it works then.

-- 
  Twisted | Christopher Armstrong: International Man of Twistery
   Radix  |          Release Manager,  Twisted Project
---------+           http://radix.twistedmatrix.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: </pipermail/twisted-python/attachments/20040521/ce9b6086/attachment.sig>


More information about the Twisted-Python mailing list