From ad8e2f53716af000b1bc96875ee2af233d82ace9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Tue, 11 Jun 2024 00:26:57 +0200 Subject: [PATCH] ui: keep working if pyinotify fails loading pyinotify has stopped working in python3.12, it fails loading with the error: ModuleNotFoundError: No module named 'asyncore' For now, ignore this error and keep working as usual. Applications icons will be loaded on GUI startup, but we loose the ability of discovering the icons of applications while the GUI is running. Closes: #1132 --- ui/opensnitch/desktop_parser.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ui/opensnitch/desktop_parser.py b/ui/opensnitch/desktop_parser.py index 67b9cced95..daf33320d2 100644 --- a/ui/opensnitch/desktop_parser.py +++ b/ui/opensnitch/desktop_parser.py @@ -1,12 +1,18 @@ from threading import Lock import configparser -import pyinotify import threading import glob import os import re import locale +is_pyinotify_available = True +try: + import pyinotify +except Exception as e: + is_pyinotify_available = False + print("Error importing pyinotify:", e) + DESKTOP_PATHS = tuple([ os.path.join(d, 'applications') for d in os.getenv('XDG_DATA_DIRS', '/usr/share/').split(':') @@ -36,7 +42,8 @@ def __init__(self): for desktop_file in glob.glob(os.path.join(desktop_path, '*.desktop')): self._parse_desktop_file(desktop_file) - self.start() + if is_pyinotify_available: + self.start() def get_locale(self): try: