XX-net/XX-Net · warning
load gi fail:%r, SysTray will not show.
Error message
load gi fail:%r, SysTray will not show.
What it means
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.
Source
Thrown at code/default/launcher/sys_platform.py:48
else:
def X_is_running():
try:
from subprocess import Popen, PIPE
p = Popen(["xset", "-q"], stdout=PIPE, stderr=PIPE)
p.communicate()
return p.returncode == 0
except:
return False
def has_gi():
try:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
return True
except Exception as e:
xlog.warn("load gi fail:%r, SysTray will not show.", e)
return False
def has_pygtk():
try:
import pygtk
pygtk.require('2.0')
import gtk
return True
except:
return False
platform = "linux"
platform_lib = os.path.join(default_path, 'lib', 'linux')
sys.path.append(platform_lib)
if X_is_running() and (has_pygtk() or has_gi()):View on GitHub (pinned to cfa5bc17b6)
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)
Defensive patterns
Strategy: fallback
Validate before calling
def has_gi():
try:
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk # noqa
return True
except Exception:
return False
if not has_gi():
print('install: sudo apt install python3-gi gir1.2-gtk-3.0') Type guard
def has_gi() -> bool:
try:
import gi; gi.require_version('Gtk', '3.0'); from gi.repository import Gtk
return True
except Exception:
return False Prevention
- 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
When it happens
Trigger: 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.
Common situations: Minimal/headless Linux or container without GTK; Debian/Ubuntu systems missing python3-gi and gir1.2-gtk-3.0 packages; GTK 4-only distributions.
Related errors
- please install *libnss3-tools* package to import GoAgent roo
- Enable auto start, create path:%s fail:%r
- import mac_tray except:%r, Please try run 'sudo pip3 install
- detect platform fail:%s
- get ip address e:%r
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/909f81b44d19f143.
Report an issue: GitHub.