[Twisted-Python] PB waitingForAnswers KeyError

William Waites ww at groovy.net
Sat Jul 23 01:56:29 EDT 2005


or more correctly,

def invert(f):
    def _i(*av, **kw)
        e = Event()
        result = []
        def _s(res):
            result.append(res)
            e.set()
        def _f():
            d = maybeDeferred(f, *av, **kw)
            d.addBoth(_s)
        reactor.callFromThread(_f)
        e.wait()

        res = result[0]
        if isinstance(res, Exception):
            raise res
        return res
    return _i

should this function exist somewhere in twisted?

-w




More information about the Twisted-Python mailing list