Re: OSX: importing gi from pygobject3: “ImportError: cannot import name _gi”





On Apr 12, 2018, at 5:33 PM, Krister <thekswenson gmail com> wrote:

Hello all,

I had a working python program that uses GTK3 as installed with
homebrew. After updating my OSX system I now get the error:

import gi
File "/usr/local/lib/python2.7/site-packages/gi/__init__.py", line 42,
in <module>
ImportError: cannot import name _gi

The minimal example that reproduces this error would be:

   # import_gi.py
   import gi

which produces:

=> /usr/local/Cellar/python\@2/2.7.14_3/bin/python2 import_gi.py
Traceback (most recent call last):
 File "import_gi.py", line 1, in <module>
   import gi
 File "/usr/local/lib/python2.7/site-packages/gi/__init__.py", line
42, in <module>
ImportError: cannot import name _gi

I've tried running

   brew reinstall pygobject3 gtk+3

which did not fix the problem.

Does someone have an idea of what may be going on?
_______________________________________________

It's girepository, not gi. And you don't usually want to import it, you want to e.g.
  from girepository import Gtk.

Regards,
John Ralls




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