aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Numerlor <[email protected]>2020-05-17 23:31:00 +0200
committerGravatar Numerlor <[email protected]>2020-05-17 23:31:00 +0200
commit540f98c8f2e890061884c70c62f38d9cfa64beff (patch)
tree40956787c65c7b28262fb7cea74e720fed378399
parentMerge pull request #400 from Numerlor/issue-command-dev-contrib (diff)
Set ayncio event loop to Selector on windows.
Python 3.8 set the default asyncio event loop on windows to Proactor, which is not supported in aiodns. Co-authored-by: MarkKoz <[email protected]>
-rw-r--r--bot/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/bot/__init__.py b/bot/__init__.py
index 4729e50c..6976e089 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -1,3 +1,4 @@
+import asyncio
import logging
import logging.handlers
import os
@@ -63,3 +64,8 @@ logging.basicConfig(
handlers=[console_handler, file_handler]
)
logging.getLogger().info('Logging initialization complete')
+
+
+# On Windows, the selector event loop is required for aiodns.
+if os.name == "nt":
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())