From 708f40f83b7a05a0d7fb2a5f2e5b422ff8204244 Mon Sep 17 00:00:00 2001 From: Vinyzu <50874994+Vinyzu@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:34:56 +0200 Subject: [PATCH] Fix Linux AssertionError --- cdp_patches/input/os_base/linux.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cdp_patches/input/os_base/linux.py b/cdp_patches/input/os_base/linux.py index 160e719..d099b5f 100644 --- a/cdp_patches/input/os_base/linux.py +++ b/cdp_patches/input/os_base/linux.py @@ -117,7 +117,8 @@ def search_windows_by_pid(query_tree, pid: int): search_windows_by_pid(window.query_tree(), pid) search_windows_by_pid(self.display.screen().root.query_tree(), self.pid) - assert res_windows, WindowClosedException(f"No windows found for PID: {self.pid}") + if not res_windows: + raise WindowClosedException(f"No windows found for PID: {self.pid}") for window in res_windows: # Getting necessary window properties @@ -158,7 +159,8 @@ def search_windows_by_pid(query_tree, pid: int): search_windows_by_pid(window.query_tree(), pid) await self._loop.run_in_executor(None, lambda: search_windows_by_pid(self.display.screen().root.query_tree(), self.pid)) - assert res_windows, WindowClosedException(f"No windows found for PID: {self.pid}") + if not res_windows: + raise WindowClosedException(f"No windows found for PID: {self.pid}") for window in res_windows: # Getting necessary window properties