[Twisted-Python] async->sync

gary jefferson garyjefferson123 at gmail.com
Fri Sep 23 13:33:45 MDT 2011


I know this is a topic that comes up occasionally, and every thread
I've see ends the same way: don't try it.

Here's my problem. I am trying to integrate some async twisted code
with pyfilesystem. Methods in pyfilesystem, such as listdir() and
open() that I need to implement expect synchronous results.

So, as far as I can tell, I only have one option: re-implement all my
client networking code outside of twisted and use the non-twisted
version for integration with this (and for other things like
command-line tools).

That solution is pretty dismal; maintaining one client-side codebase
is hard enough. Keeping two up to date sounds like a nightmare.

So, am I missing some other more elegant solution? Is there really no
way to turn async, deferred-returning twisted code into synchronous
result-returning code, via clever use of wrappers etc?

Thanks,
Gary



More information about the Twisted-Python mailing list