[Twisted-Python] Return only when value/handle is available

vikas kumar vikas.c.kumar at oracle.com
Wed Sep 3 05:32:04 MDT 2014


Hi,

I am little new to twisted.
I've a function(get_handle) which returns a handle.

But get_handle() may throw an exception(SystemDelayException) because of 
some delay in system.
My requirement is : When I get SystemDelayException re-attempt 
get_handle() and return only when handle is available. How do I use 
deferred/reactor in this scenario?

try:
     handle = yield self.get_handle()
except SystemDelayException:
     // code to re-attempt get_handle and return only when handle is 
available

Regards
Vikas




More information about the Twisted-Python mailing list