Opened 11 years ago

Last modified 11 years ago

#40179 closed defect

Can't import gi.repository after installing gtk3 — at Version 1

Reported by: istlota@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc: cal@…
Port: gtk3

Description (last modified by ryandesign (Ryan Carsten Schmidt))

After failing to get gtk3 to work, as a hail mark pass, I completely uninstalled MacPorts per section 2.5 of the guide, then reinstalled MacPorts from the source tarball. After that, I only port installed two ports: python27 and gtk3 +x11. That worked without any reported problems. I then coded this simple program which ran okay, but note that it does not use the new gobject-introspection Way of doing things with gtk3:

import gobject
from gobject import GObject

class MyClass(GObject):
    prop = gobject.property(type=int)

def cb(sender, prop):
    print "property '%s' changed on %r." % (prop.name, sender)

inst = MyClass()
inst.connect("notify", cb)
inst.prop = 42

Next, I coded the following program which does use the gobject-introspection Way. But it fails indicating an import error for the 'from gi.repository import GObject' statement. Why does installing the gtk3 port on my mac end up with python not being able to find gi.repository?

from gi.repository import GObject


class MyClass(GObject.GObject):

    prop = GObject.property(type=int)


def cb(sender, prop):
    print "property '%s' changed on %r." % (prop.name, sender)

inst = MyClass()
inst.connect("notify", cb)
inst.prop = 42

Change History (1)

comment:1 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: cal@… added
Description: modified (diff)
Keywords: gi.repository removed

Remember to use WikiFormatting when writing in Trac. I'm Cc'ing the maintainer of gtk3; maybe he knows the answer to your question.

Note: See TracTickets for help on using tickets.