On Mon, 8 Oct 2007 11:15:33 +0300, kgi <iacovou@gmail.com> wrote:
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.
You want to do things with the terminal. twistd also wants to do things with the terminal (particularly if you use -n). These two things come into conflict. The added call to reactor.run() seems to "fix" the issue because it prevents twistd from finishing the usual startup tasks, so your code gets to run and has the terminal to itself. It's probably not feasible at this point to provide a terminal interface to an application run with twistd on the controlling pty for that application. This is a feature which would need to be added to twistd. Jean-Paul