[Twisted-Python] Synchronous Wrapper for Deferreds

Ken Kinder ken at kenkinder.com
Sat Mar 19 00:13:22 EST 2005

A day or two ago, I inquired on IRC about making calls from an existing 
synchronous script. The script is not related to any Twisted activity, 
so minimal intervention was sort of a goal. Obviously this doesn't work 
on non-transient objects such as Perspective Broker ones, but here's 
what I came up with... (See attached) Obviously there is some cleaning 
up to do, but it demonstrates the idea.

I have three questions: (1) I know this isn't the ideal way to use 
Twisted, but is there anything inherently problematic about my solution 
for one-off calls to Twisted. (2) I understand there are problems with 
running the same reactor twice. What are those problems and is there a 
recommended work around? (3) Are there any ideas on making a synchronous 
version of a Perspective Broker client to integrate into existing 
synchronous applications more easily?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: waitDeferred.py
Type: application/x-python
Size: 627 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20050318/74caac16/attachment.bin 

More information about the Twisted-Python mailing list