I want to work with the dbus-python library (I just pip installed it) and they provide some nice example about making two programs communicate. In one of their .py file there is an "import gobject" line which results in a "ImportError: No module named gobject" when I run this example. I would like to know what I should install to get this module (I am working with Python3 on an Ubuntu).
When I use python2.7 this import is working and the gobject.__file__
variable contains:
/usr/lib/python2.7/dist-packages/gobject/__init__.pyc
The require_version method ensures the namespace gets loaded with the given version. The gi. repository is the Python module for PyGObject . PyGObject (Python GObject introspection) contains Python bindings and support for GObject, GLib, GTK and other libraries. $ ./version.py 4.6.5.
PyGObject is a Python extension module that gives clean and consistent access to the entire GNOME software platform through the use of GObject Introspection. PyGObject provides full support of GObject Introspection and all of its features (callbacks, GVariant support, closures, sub-classing, etc.).
gi. repository is the Python module for PyGObject (which stands for Python GObject introspection) which holds Python bindings and support for the GTK+ 3 toolkit and for the GNOME apps.
Install python3-gi
and import it this way
from gi.repository import GObject
or so you don't have to rename all the references
from gi.repository import GObject as gobject
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With