Skip to content

Commit

Permalink
Fix aiomqtt on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lukipuki committed Jun 9, 2024
1 parent 733b048 commit fa8e468
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/yaroc/scripts/mqtt_forwarder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import asyncio
import logging
import os
import sys
import tomllib

from ..sources.mqtt import MqttForwader
Expand Down Expand Up @@ -33,4 +35,8 @@ async def main():
await forwarder.loop()


if sys.platform.lower() == "win32" or os.name.lower() == "nt":
from asyncio import WindowsSelectorEventLoopPolicy, set_event_loop_policy

set_event_loop_policy(WindowsSelectorEventLoopPolicy())
asyncio.run(main())
6 changes: 6 additions & 0 deletions python/yaroc/scripts/send_punch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import asyncio
import datetime
import logging
import os
import socket
import sys
import time
import tomllib

Expand Down Expand Up @@ -115,4 +117,8 @@ async def main():
await ps.loop()


if sys.platform.lower() == "win32" or os.name.lower() == "nt":
from asyncio import WindowsSelectorEventLoopPolicy, set_event_loop_policy

set_event_loop_policy(WindowsSelectorEventLoopPolicy())
asyncio.run(main())

0 comments on commit fa8e468

Please sign in to comment.