How to shutdown the loop and print error if coroutine raised an exception with asyncio?
问题 Suppose I have a few coroutines running in a loop. How to make so that if some of them failed with exception the whole program would fail with this exception? Because right now asyncio doesn't even prints the error messages from coroutines unless I use logging level "DEBUG". from asyncio import get_event_loop, sleep async def c(sleep_time=2, fail=False): print('c', sleep_time, fail) if fail: raise Exception('fail') while True: print('doing stuff') await sleep(sleep_time) loop = get_event_loop