2015-12-21
Use gi.require_version('Gtk', '3.0') before import
On recent Fedora importing Gtk the following way
from gi.repository import Gtk
gives the following error:
./hclean.py:27: PyGIWarning: Gtk was imported without specifying a version first.
Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import Gtk
The error is fixed by requiring the Gtk version:
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
Now the program starts without errors.
Solution found on programcreek.com.