[Twisted-Python] Newbie question

Simon Pickles sipickles at hotmail.com
Thu Jan 24 14:33:05 EST 2008


Hi,

I thought I'd better try and understand twisted a bit more rather than 
just using it!

Can anyone tell me why this code is erroneous?

#####################
from twisted.internet import reactor, defer

print "test"

def printResult(s):
    print "Data: %s", str(s)

def printEnd():
    print "End"

def printError(error):
    print error

d = defer.Deferred()

reactor.callLater(4, d.callback)
d.addCallback(printEnd)
d.addErrback(printError)

reactor.run()
###################################
I get the error:

TypeError: callback() takes exactly two arguments (1 given) in 
twisted/internet/base.py call.func(*call.args, **call.kw)

Thanks

Simon

-- 
Linux user #458601 - http://counter.li.org.







More information about the Twisted-Python mailing list