Create asyncioPoliciesFix.py
Browse files- helper/asyncioPoliciesFix.py +15 -0
helper/asyncioPoliciesFix.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import sys
|
3 |
+
|
4 |
+
|
5 |
+
def decorator_asyncio_fix(func):
|
6 |
+
def wrapper(*args):
|
7 |
+
if (
|
8 |
+
sys.version_info[0] == 3
|
9 |
+
and sys.version_info[1] >= 8
|
10 |
+
and sys.platform.startswith("win")
|
11 |
+
):
|
12 |
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
13 |
+
return func(*args)
|
14 |
+
|
15 |
+
return wrapper
|