Created
September 21, 2018 18:02
-
-
Save itdaniher/b2b53884a18ac44a319bb544a169145e to your computer and use it in GitHub Desktop.
π
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 asyncio | |
import sys | |
async def test(): | |
1//0 | |
loop = asyncio.get_event_loop() | |
def asyncio_handler(loop, context): | |
print("XXXX", "got", context) | |
def sys_handler(*args, **kwargs): | |
print("sync handler") | |
sys.excepthook = sys_handler | |
loop.set_exception_handler(asyncio_handler) | |
print('asyncio exception handler:', loop.get_exception_handler()) | |
print('sys.excepthook', sys.excepthook) | |
task = loop.create_task(test()) | |
loop.run_until_complete(task) | |
loop.run_until_complete(asyncio.sleep(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment