Skip to content

Instantly share code, notes, and snippets.

@lsbardel
Created July 25, 2014 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsbardel/63c8d62ee80261b09de9 to your computer and use it in GitHub Desktop.
Save lsbardel/63c8d62ee80261b09de9 to your computer and use it in GitHub Desktop.
yield from future and trollius in debug mode
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