Hello,<br><br>I discovered Python recently and even more recently the Twisted module.<br><br>I have a problem with the Twisted reactor and I would like to understand for which reason my program freezes.<br><br>Here the code which should loop forever :
<br><br>from twisted.internet import reactor<br>from twisted.internet import task<br><br>class reactorProb(object):<br> def __init__(self):<br> self.count = 5<br> self._callback = task.LoopingCall(self.Heartbeat
)<br> self._callback.start(1, now = False)<br> def Heartbeat(self):<br> print "Top"<br> self.count -= 1<br> if (self.count == 0):<br> print "Exit"<br> self._callback.stop()
<br> del self._callback<br> reactor.stop()<br><br>while (True):<br> rp = reactorProb()<br> print "Enter into reactor.run()"<br> reactor.run()<br> print "Leave from reactor.run
()"<br><br> <br>I got this:<br><br>Enter into reactor.run()<br>Top<br>Top<br>Top<br>Top<br>Top<br>Exit<br>Leave from reactor.run()<br>Enter into reactor.run()<br>Top<br>Top<br>Top<br>Top<br>Top<br>Exit<br><br>Thus I start first once the reactor, I stop it then I start again and it freezes instead of stopping it the reactor.
<br><br>Could somebody explain me it why?<br><br>Thank you in advance.<br><br>smu