{"record":{"id":"909f81b44d19f143","repo":"XX-net/XX-Net","slug":"load-gi-fail-r-systray-will-not-show","errorCode":null,"errorMessage":"load gi fail:%r, SysTray will not show.","messagePattern":"load gi fail:%r, SysTray will not show\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"code/default/launcher/sys_platform.py","lineNumber":48,"sourceCode":"    else:\n        def X_is_running():\n            try:\n                from subprocess import Popen, PIPE\n                p = Popen([\"xset\", \"-q\"], stdout=PIPE, stderr=PIPE)\n                p.communicate()\n                return p.returncode == 0\n            except:\n                return False\n\n\n        def has_gi():\n            try:\n                import gi\n                gi.require_version('Gtk', '3.0')\n                from gi.repository import Gtk as gtk\n                return True\n            except Exception as e:\n                xlog.warn(\"load gi fail:%r, SysTray will not show.\", e)\n                return False\n\n\n        def has_pygtk():\n            try:\n                import pygtk\n                pygtk.require('2.0')\n                import gtk\n                return True\n            except:\n                return False\n\n\n        platform = \"linux\"\n        platform_lib = os.path.join(default_path, 'lib', 'linux')\n        sys.path.append(platform_lib)\n\n        if X_is_running() and (has_pygtk() or has_gi()):","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/launcher/sys_platform.py#L30-L66","documentation":"sys_platform.has_gi tries to import PyGObject (gi) with Gtk 3.0 to decide whether a Linux system tray can be shown. Any failure (module missing, wrong Gtk version, dynamic-linker errors) is caught and logged, and the function returns False so the launcher falls back to another tray backend or no tray.","triggerScenarios":"Calling has_gi() on Linux when python3-gi is not installed, gi.require_version('Gtk','3.0') fails because only Gtk 4 is available, or libgtk-3 shared libraries cannot be loaded.","commonSituations":"Minimal/headless Linux or container without GTK; Debian/Ubuntu systems missing python3-gi and gir1.2-gtk-3.0 packages; GTK 4-only distributions.","solutions":["Install PyGObject and GTK3 introspection data: sudo apt install python3-gi gir1.2-gtk-3.0 libgtk-3-0","If on a headless machine, ignore the warning — the launcher will use a fallback (no tray) backend","Check python3 -c 'import gi; gi.require_version(\"Gtk\",\"3.0\")' to reproduce and see the real error","Verify the same python interpreter the launcher uses has gi installed (pip vs apt python)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"def has_gi():\n    try:\n        import gi\n        gi.require_version('Gtk', '3.0')\n        from gi.repository import Gtk  # noqa\n        return True\n    except Exception:\n        return False\nif not has_gi():\n    print('install: sudo apt install python3-gi gir1.2-gtk-3.0')","typeGuard":"def has_gi() -> bool:\n    try:\n        import gi; gi.require_version('Gtk', '3.0'); from gi.repository import Gtk\n        return True\n    except Exception:\n        return False","tryCatchPattern":null,"preventionTips":["Install python3-gi and gir1.2-gtk-3.0 on Linux desktop images","Probe tray backends with has_gi/has_pygtk before choosing one","Accept non_tray fallback on headless systems"],"tags":["linux","gtk","pygobject","systray"],"backgroundTag":"gtk-module-import-failed","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}