Skip to content

Commit

Permalink
ui: keep working if pyinotify fails loading
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gustavo-iniguez-goya committed Jun 10, 2024
1 parent 58aa979 commit ad8e2f5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ui/opensnitch/desktop_parser.py
Original file line number Diff line number Diff line change
@@ -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(':')
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ad8e2f5

Please sign in to comment.