Skip to content

Commit 9fde717

Browse files
committed
Fix OSError on exit
1 parent 48a4a1b commit 9fde717

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tibber/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
DEMO_TOKEN = "5K4MVS-OjfWhK_4yrjOlFe1F6kJXPVf7eQYggo8ebAE"
33
API_ENDPOINT = "https://api.tibber.com/v1-beta/gql"
44

5+
# The event loop type causes problems on windows systems when exiting.
6+
import os
7+
import asyncio
8+
if os.name == "nt":
9+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
10+
511
# Import modules after defining constants to avoid circular import error.
612
from .account import Account
713

0 commit comments

Comments
 (0)