Skip to content

Commit

Permalink
[Bugfix] Workaround for aysncio since loop is not implemented on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
andreacomplus committed Jul 7, 2023
1 parent 236f784 commit 95df239
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions monitor-qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ def arg_layout(value):

args = parser.parse_args()

# TODO : check the number of network interfaces
# check the number of network interfaces
adapters = ifaddr.get_adapters()
adaptersList = ()
interfaceIndex = 0
# TODO : if > 1, list all interfaces with their IP and an index, and request the user to select the good interface
# if > 1, list all interfaces with their IP and an index, and request the user to select the good interface
if len(list(adapters)) > 1:
for index, adapter in enumerate(adapters):
adaptersList = adaptersList + (adapter.name, )
for ip in adapter.ips:
if ip.is_IPv4:
print(str(index) + ") " + adapter.nice_name + " %s/%s" % (ip.ip, ip.network_prefix))
# TODO: read the index chosen by the user, if valid persist the interface name in a property
# read the index chosen by the user, if valid persist the interface name in a property
interfaceIndex = int(input('Please select the network interface used by Pioneer ProDj Link\n'))
network_interface = adaptersList[interfaceIndex]
else:
Expand Down
3 changes: 3 additions & 0 deletions prodj/network/nfsclient.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import sys
import logging
import os
import socket
Expand All @@ -13,6 +14,8 @@
class NfsClient:
def __init__(self, prodj):
self.prodj = prodj
if sys.version_info >= (3, 8) and sys.platform.lower().startswith("win"):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
self.loop = asyncio.new_event_loop()
self.receiver = RpcReceiver()

Expand Down

0 comments on commit 95df239

Please sign in to comment.