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.

(cherry picked from commit ad8e2f5)
  • Loading branch information
gustavo-iniguez-goya committed Jun 13, 2024
1 parent 0fc4239 commit 94e8156
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,13 +1,19 @@
from threading import Lock
import configparser
import pyinotify
import threading
import glob
import os
import re
import shutil
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 @@ -37,7 +43,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 94e8156

Please sign in to comment.