Created
July 25, 2014 12:50
-
-
Save lsbardel/63c8d62ee80261b09de9 to your computer and use it in GitHub Desktop.
yield from future and trollius in debug mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import logging | |
os.environ['PYTHONASYNCIODEBUG'] = 'debug' | |
os.environ['TROLLIUSDEBUG'] = 'debug' | |
import asyncio | |
from asyncio import Future | |
import trollius | |
asyncio.set_event_loop_policy(trollius.get_event_loop_policy()) | |
def coro(): | |
future = Future() | |
future._loop.call_later(1, future.set_result, 'Hi') | |
result = yield from future | |
print(result) | |
if __name__ == '__main__': | |
logging.basicConfig(level='DEBUG') | |
loop = trollius.get_event_loop() | |
loop.run_until_complete(coro()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment