[Twisted-Python] Newbie question
Petr Mifek
pm-twisted-python at anapol.cz
Thu Jan 24 12:58:50 MST 2008
UGHHH, Thunderbird's syntax coloring sucks ;)
of course read that
result = "I'm the result"
Otherwise, look at:
http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorTime.html#callLater
especially look at the possible args and kwargs arguments and it'll give
you a delayedCall:
http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IDelayedCall.html
Petr
Petr Mifek napsal(a):
> 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
>>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
More information about the Twisted-Python
mailing list