import sys import asyncio asyncio.coroutines._DEBUG = True loop = asyncio.get_event_loop() @asyncio.coroutine def coro(): pass try: raise KeyError except KeyError: info = sys.exc_info() try: coro().throw(*info) except KeyError: pass