[Twisted-Python] Newbie question
Petr Mifek
pm-twisted-python at anapol.cz
Thu Jan 24 14:49:14 EST 2008
Hi,
try exactly what it says, that is, supply callback with an argument:
example:
result = 'I'm the result'
reactor.callLater(4, d.callback, result)
Then it should do.
Petr
Simon Pickles napsal(a):
> 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
>
More information about the Twisted-Python
mailing list