Usually at work I lock my screen when I leave, log off once a week, and rarely reboot. All my packages are up-to-date.
Yesterday I rebooted, and this morning I can't launch my Python3/Gtk3 apps :
JeanCoiron@myhostname:/opt/myapps/dev$ ./mywindow.py
Traceback (most recent call last):
File "./mywindow.py", line 4, in <module>
from gi.repository import Gtk
File "/usr/lib/python3/dist-packages/gi/importer.py", line 76, in load_module
dynamic_module._load()
File "/usr/lib/python3/dist-packages/gi/module.py", line 224, in _load
overrides_modules = __import__('gi.overrides', fromlist=[self._namespace])
File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 1533, in <module>
raise RuntimeError("Gtk couldn't be initialized")
RuntimeError: Gtk couldn't be initialized
Code of this example app :
#!/usr/bin/python3
# Filename: mywindow.py
from gi.repository import Gtk
from gi.repository import Gdk
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="My window")
self.mainGrid = Gtk.Grid()
self.add(self.mainGrid)
self.lbl = Gtk.Label("Hello World")
self.mainGrid.add(self.lbl)
mainWin = MyWindow()
mainWin.connect("delete-event", Gtk.main_quit)
mainWin.show_all()
Gtk.main()
If I launch it from Geany it works, not from a standard terminal. Same for all my python3/gtk3 apps. From a Geany terminal echo $PATH is exactly the same as from a standard terminal. Curently DISPLAY=':0', I tried with no DISPLAY var and with DISPLAY='localhost:0'
Any idea where I should search ?
-EDIT-
This is a Gtk issue only : I can launch Gtk apps like gedit from Unity launcher but not from a terminal.
JeanCoiron@myhostname:/opt/myapps/dev$ gedit /usr/lib/python3/dist-packages/gi/overrides/Gtk.py
Cannot open display:
Run 'gedit --help' to see a full list of available command line options.
JeanCoiron@myhostname:/opt/myapps/dev$ echo $DISPLAY
:0
Gtk.init_check()
which fails, so Googling that might give some more useful results. – Timo Mar 28 '13 at 10:33