Problem with GI and pygtk



Hello,

my name is Thomas and I'm a computer scientist from Berlin, working in the embedded industry. In my spare time I work in the Geany IDE and Rockbox.

I'm struggling to make pygtk work with a library that provides gir bindings. I read that pygtk is based on pygobject and therefore I would expect that pygtk would work together with other GI libraries (perhaps in a limited fashion).

I attached my files for a reduced test scenario. test.c has a function that returns a GtkWidget. test.[ch] go into a shared library that is g-ir-scanned. test.py calls its function via gi. Since the function returns a GtkWidget this is where things break.

This is the error output (make everything, then run with GI_TYPELIB_PATH=$PWD python2 test.py): /usr/lib/python2.7/site-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
   import gobject._gobject
Traceback (most recent call last):
   File "test.py", line 11, in <module>
     l = Test.label_new("Test Label")
File "/usr/lib/python2.7/site-packages/gi/importer.py", line 68, in load_module
     dynamic_module._load()
   File "/usr/lib/python2.7/site-packages/gi/module.py", line 296, in _load
self._overrides_module = importlib.import_module('gi.overrides.' + self._namespace) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
     __import__(name)
File "/usr/lib/python2.7/site-packages/gi/overrides/Gtk.py", line 26, in <module>
     from gi.repository import GObject
File "/usr/lib/python2.7/site-packages/gi/importer.py", line 68, in load_module
     dynamic_module._load()
   File "/usr/lib/python2.7/site-packages/gi/module.py", line 296, in _load
self._overrides_module = importlib.import_module('gi.overrides.' + self._namespace) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
     __import__(name)
File "/usr/lib/python2.7/site-packages/gi/overrides/GObject.py", line 534, in <module>
     class Object(GObjectModule.Object):
File "/usr/lib/python2.7/site-packages/gi/module.py", line 222, in __getattr__
     wrapper = metaclass(name, bases, dict_)
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases


Perhaps I'm doing something wrong, or am I'm miserably misunderstanding pygtk/pygobject/gi. Can you assist me and lighten me up, please?

Best regards.

Attachment: Makefile
Description: Text document

Attachment: test.c
Description: Text Data

Attachment: test.h
Description: Text Data

Attachment: test.py
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]