From 6fe18c66c5cb6adcb89a40d33e5ce078331dcc04 Mon Sep 17 00:00:00 2001 From: MarkKoz Date: Wed, 22 Apr 2020 13:04:22 -0700 Subject: Use selector event loop on Windows aiodns requires the selector event loop for asyncio. In Python 3.8, the default event loop for Windows was changed to proactor. To fix this, the event loop is explicitly set to selector. --- bot/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bot/__init__.py b/bot/__init__.py index 2dd4af225..4131b69e9 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -1,3 +1,4 @@ +import asyncio import logging import os import sys @@ -59,3 +60,8 @@ coloredlogs.install(logger=root_log, stream=sys.stdout) logging.getLogger("discord").setLevel(logging.WARNING) logging.getLogger("websockets").setLevel(logging.WARNING) logging.getLogger(__name__) + + +# On Windows, the selector event loop is required for aiodns. +if os.name == "nt": + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) -- cgit v1.2.3