From d379bb138cdbf1100f2c5bf64d45d0def8a768c1 Mon Sep 17 00:00:00 2001 From: deepend Date: Sun, 22 Feb 2026 11:42:49 -0700 Subject: [PATCH] Added Flatpak-specific Python module search paths in plugin init: when FLATPAK_ID is present, the loader now also probes /app/lib/zoitechat/python and /app/lib/x86_64-linux-gnu/zoitechat/python before importing zoitechat. Kept the existing safe behavior intact: paths are only added if they exist and are not already in sys.path, so this broadens compatibility without duplicating entries. --- plugins/python/python.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/python/python.py b/plugins/python/python.py index 93c56040..b8767a8e 100644 --- a/plugins/python/python.py +++ b/plugins/python/python.py @@ -550,6 +550,12 @@ def _on_plugin_init(plugin_name, plugin_desc, plugin_version, arg, libdir): os.path.join(appdir, 'usr', 'lib', 'x86_64-linux-gnu', 'zoitechat', 'python'), ]) + if os.getenv('FLATPAK_ID'): + modpaths.extend([ + '/app/lib/zoitechat/python', + '/app/lib/x86_64-linux-gnu/zoitechat/python', + ]) + for modpath in modpaths: if os.path.isdir(modpath) and modpath not in sys.path: sys.path.append(modpath)