thanks for help, I will read the documents of smart-questions soon:)<br>last night I read the twisted's book on the its web site, and I think there are 2 major mistake there. 1. the defer should not be inintinitialized&nbsp; in&nbsp; the __init__ phase, that's easy to understood why there are AlreadCalledError. 2. twisted use task to run the loop. :D
<br>that's a sample code here.<br><br>from twisted.internet import reactor, defer, task<br>class snmpFactory:<br> &nbsp; &nbsp;def __init__(self):&nbsp;&nbsp; &nbsp;  <br><br> &nbsp; &nbsp;def readValue(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.deferred = defer.Deferred()<br>
 &nbsp; &nbsp; &nbsp; &nbsp;vol = readValue(self.voltageIp, voltageOid)<br> &nbsp; &nbsp; &nbsp; &nbsp;temp = readValue(self.powerIp, temperatureOid)<br> &nbsp; &nbsp; &nbsp;&nbsp; reactor.callLater(0, self.handleResult, (vol, temp))<br> &nbsp; &nbsp; &nbsp;&nbsp; return self.deferred<br> &nbsp; &nbsp;def handleResult(self, (vol, temp)):
<br> &nbsp; &nbsp; &nbsp; &nbsp;slice = time.strftime(&quot;%H:%M:%S&quot;)<br> &nbsp; &nbsp; &nbsp; &nbsp;print slice, ' the voltage is %s\nthe temperature is %s' % (vol,<br>temp)<br><br>s = snmpFactory()<br>l = task.LoopingCall(s.readSnmpValue)<br>l.start(2)<br>
reactor.run()<br><br>It's my first twisted program, thank for Jonathan.