tornado
tornado copied to clipboard
Problem with transform tornado Future into Asyncio Future
I have a function like this:
@asyncio.coroutine
def fetchDatabase():
ans = self._httpClient.fetch(request, callback, raise_error)
ans = yield from asyncio.ensure_future( platform.asyncio.to_asyncio_future(ans))
return ans
I call this function by using:
response = yield from fetchDatabase()
In tornado 4.1 , this can work properly and I got the http response, but in tornado 4.4 I got an error which complain about
File "/opt/lib/python3.5/asyncio/futures.py", line 362, in __iter__
assert self.done(), "yield from wasn't used with future"
AssertionError: yield from wasn't used with future
I am not sure what is the correct way when I want to use asyncio library to yield from tornado Future...
Hi all,
I have installed async loop by using AsyncIOMainLoop().install() .. but still have this problem
thanks,