[Twisted-Python] stdio.StandardIO, ServerProtocol and Services.

kgi iacovou at gmail.com
Mon Oct 8 04:15:33 EDT 2007


On Saturday 06 October 2007 18:04:46 Phil Mayers wrote:
> > The fact that adding reactor.run() (which shouldn't be needed in a
> > Service, right?) implies to me that the reactor isn't starting up
> > properly without it, and I can't see why.
>
> How are you starting this code? Are you just executing it? If so, don't
> do that. Use:
>
> twistd -noy thefile.py
>
> The Twisted application/service code just creates the relevant objects;
> the application object still needs to be run. "twistd" will do this for
> you.

Hi Phil; thanks for your reply.

Sadly, I am already using twistd to start this code. Virtually all my Twisted 
code is service.Service-based, and I am accustomed to just boshing the 
various services into an application hierarchy and letting twistd Do The 
Right Thing, which is why I'm confused as to why this snippet seems not to 
work.

Or rather, let me rephrase that: I'm not surprised that my code *overall* 
doesn't work quite how I would like, because I simply don't understand the 
inner workings of insults.ServerProtocol and recvline.RecvLine well enough, 
and I'm probably just being bone-headed.

However, I *am* surprised that adding an "illegal" reactor.run() to a 
service's startService() method seems to "kick" the snippet into behaving 
differently.

Cheers,

Ricky




More information about the Twisted-Python mailing list