[Twisted-Python] twisted eats the error
steven meiers
commercials24 at yahoo.de
Mon Feb 13 16:45:37 MST 2017
>
> [SNIP]
>
> The “Unhanded error in Deferred” isn’t coming from your call to
> deferToThread, it is coming from your task.LoopingCall. When you
> invoke .start() on your LoopingCall instance, it returns a Deferred,
> which fires its assigned callback handler when you call .stop() on
> the LoopingCall instance, and which fires its assigned errback
> handler if an exception occurs while running the function (in this
> case runEverySecond) passed to the LoopingCall.
>
> In other words, you need this:
>
> l = task.LoopingCall(runEverySecond, ‘lala’)
> l.addErrback(printError)
>
you probably meant:
l = task.LoopingCall(runEverySecond, 'lala')
d = l.start(1.0)
d.addErrback(printError)
your version gives me a attribute error, thanks for clarifying that.
More information about the Twisted-Python
mailing list