[Twisted-Python] what's wrong in my code?

wang wei wgwigw at gmail.com
Tue Jul 4 22:33:13 EDT 2006


hi, I got 'twisted.internet.defer.alreadycallederror' error back.
here is my code, what's wrong in it? thanks for help.

class snmpFactory:
    def __init__(self, filename):

        self.deferred = defer.Deferred()

    def readValue(self):
        vol = readValue(self.voltageIp, voltageOid)
        temp = readValue(self.powerIp, temperatureOid)
        self.deferred.callback((vol, temp))
        self.deferred.addCallback(self.handleResult)
    def handleResult(self, (vol, temp)):
        slice = time.strftime("%H:%M:%S")
        print slice, ' the voltage is %s\nthe temperature is %s' % (vol,
temp)

s = snmpFactory()
i = 1
while (i < 10):
    reactor.callLater(5, s.readSnmpValue)
    i += 1
    time.sleep(10)
reactor.run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20060705/573af3a4/attachment.htm 


More information about the Twisted-Python mailing list