how to import the gda-ui module in python?
-
21-12-2019 - |
Question
I'm trying to get started with libgda in python (3.4). To import the Gda module i do from gi.repository import Gda
I want to use GdauiTreeStore
but i don't know how to import the Gda-ui module...
Things like that didn't work:
from gi.repository import Gdaui
from gi.repository import GdaUi
from gi.repository import GdaUI
from gi.repository import Gda-ui
from gi.repository import Gda-Ui
from gi.repository import Gda-UI
(and same with underscore instead of dash)
Solution
Are you sure libgda-ui
(and its development package) are installed? Ever since introspection was added to libgda-ui in 2010, the GIR file has been called Gdaui-$version.gir
.
Importing it using:
from gi.repository import Gdaui
works fine for me in Python 2 and 3.
Note that if the GIR file did contain a hyphen in its name, you might be able to import it using:
import importlib
importlib.import_module('gi.repository.Gda-ui')
though I have been unable to test this.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow