issue with twisted and reactor. Can't stop reactor
Jean-Paul Calderone
exarkun at divmod.com
Tue May 12 16:33:06 EDT 2009
On Tue, 12 May 2009 14:30:04 -0500, Nick Craig-Wood <nick at craig-wood.com> wrote:
>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().
reactor.callWhenRunning can also be used (instead of callLater with a very
short delay).
You can also set stuff up first, /then/ call reactor.run(). eg, it is
completely fine to write:
reactor.connectTCP(...)
reactor.run()
Jean-Paul
More information about the Python-list
mailing list