[MacPorts] #40179: Can't import gi.repository after installing gtk3

MacPorts noreply at macports.org
Sun Aug 18 16:41:33 PDT 2013


#40179: Can't import gi.repository after installing gtk3
------------------------+--------------------------------
  Reporter:  istlota@…  |      Owner:  macports-tickets@…
      Type:  defect     |     Status:  new
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.2.0
Resolution:             |   Keywords:
      Port:  gtk3       |
------------------------+--------------------------------
Changes (by ryandesign@…):

 * keywords:  gi.repository =>
 * cc: cal@… (added)


Old description:

> 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

New description:

 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
 }}}

--

Comment:

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

-- 
Ticket URL: <https://trac.macports.org/ticket/40179#comment:1>
MacPorts <http://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list