Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install gobject module?

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
like image 558
MarAja Avatar asked May 19 '16 12:05

MarAja


People also ask

What is GI module in Python?

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.

What is PyGObject used for?

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.).

What is GI repository?

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.


1 Answers

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
like image 185
pacholik Avatar answered Oct 08 '22 13:10

pacholik