issue with twisted and reactor. Can't stop reactor

Nick Craig-Wood nick at craig-wood.com
Tue May 12 21:30:04 CEST 2009


Gabriel <gabriel at opensuse.org> wrote:
>  Jean-Paul Calderone escribió:
>  > None of the reactors in Twisted are restartable.  You can run and
>  stop them
> > once.  After you've stopped a reactor, you cannot run it again.  This is
> > the
> > cause of your problem.
> > 
> > Jean-Paul
> 
>  I see.
>  Is it possible to do what I want using twisted? or
>  I should found another way?

You have to go twisted...

Your program should call reactor.run() once and everything you need
your program to do should be started off from twisted callbacks (eg
timer callbacks or deferred objects).

To get your program to do something immediately after it is started,
use reactor.callLater() before calling reactor.run().

You can't mix and match programming styles with twisted - it is all
asynchronous callbacks or nothing in my experience!  That takes a bit
of getting your head round at first.

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list