[Twisted-Python] Discovering Twisted : reactor.stop()

Jean-Paul Calderone exarkun at divmod.com
Thu Sep 27 08:58:00 EDT 2007


On Thu, 27 Sep 2007 14:37:53 +0200, Steve MULLER <thoma.hauc at gmail.com> wrote:
> [snip]
>
>Is there any other way to do so kind of job ?
>

The only interesting thing your example did was try to start the reactor
more than once.  There's no way to do that. ;)

If you want to do more than one thing, then just do more than one thing.
You don't need to stop the reactor until the entire program has completed
and you are ready for the process to exit.

If you're trying to figure out how to organize your code so that you can
do one thing after another thing has finished, then you should look at
Deferreds, since that is precisely what they are good for.  Your example
included a Deferred, in fact - LoopingCall.start() returns one which is
called back when the stop() method is called on that LoopingCall instance.

Jean-Paul




More information about the Twisted-Python mailing list