Skip to content

Commit 1eaa10a

Browse files
authored
Merge pull request #329 from antonlacon/py313-compat
dbus_utils.py: adjust use of get_event_loop for its deprecation
2 parents a0c61d0 + 0fbc2de commit 1eaa10a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

resources/lib/dbus_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,12 @@ def run_method(bus_name, path, interface, method_name, *args, **kwargs):
128128
return future.result()
129129

130130

131-
LOOP = asyncio.get_event_loop()
131+
try:
132+
LOOP = asyncio.get_running_loop()
133+
except RuntimeError:
134+
LOOP = asyncio.new_event_loop()
135+
asyncio.set_event_loop(LOOP)
136+
132137
BUS = ravel.system_bus()
133138
BUS.attach_asyncio(LOOP)
134139
LOOP_THREAD = LoopThread(LOOP)

0 commit comments

Comments
 (0)