Opened 5 years ago

Closed 2 years ago

Last modified 2 years ago

#58122 closed defect (fixed)

gexiv2: Python module fails to load

Reported by: mklein-de (Michael Klein) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: ctreleaven (Craig Treleaven)
Port: gexiv2

Description

The python module of gexiv2 fails to load both in python 2.7 and python 3.6 with an AttributeError:

$ python2.7 -c "from gi.repository import GExiv2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gi/importer.py", line 146, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gi/overrides/__init__.py", line 125, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gi/overrides/GExiv2.py", line 36, in <module>
    class Metadata(GExiv2.Metadata):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gi/module.py", line 138, in __getattr__
    self.__name__, name))
AttributeError: 'gi.repository.GExiv2' object has no attribute 'Metadata'
$ python3.6 -c "from gi.repository import GExiv2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gi/importer.py", line 146, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gi/overrides/__init__.py", line 125, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gi/overrides/GExiv2.py", line 36, in <module>
    class Metadata(GExiv2.Metadata):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gi/module.py", line 138, in __getattr__
    self.__name__, name))
AttributeError: 'gi.repository.GExiv2' object has no attribute 'Metadata'
$ port installed gexiv2
The following ports are currently installed:
  gexiv2 @0.10.9_1+python27+python36 (active)

Change History (9)

comment:1 Changed 5 years ago by jmroot (Joshua Root)

Cc: devans@… removed
Owner: set to dbevans
Status: newassigned

comment:2 Changed 3 years ago by ctreleaven (Craig Treleaven)

I am seeing this error with Gramps 5.1.3:

$ gramps --safe
dbus[15542]: Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!

** (gramps:15542): WARNING **: 14:05:14.616: Failed to load shared library './gexiv2/libgexiv2.2.dylib' referenced by the typelib: dlopen(./gexiv2/libgexiv2.2.dylib, 9): image not found
ERROR: Failed reading plugin registration gramplet.gpr.py
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gramps/gen/plug/_pluginreg.py", line 1195, in scan_dir
    exec (compile(stream, filename, 'exec'),
  File "gramplet.gpr.py", line 409, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/importer.py", line 145, in load_module
    dynamic_module = load_overrides(introspection_module)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/overrides/__init__.py", line 118, in load_overrides
    override_mod = importlib.import_module(override_package_name)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/overrides/GExiv2.py", line 110, in <module>
    if not GExiv2.initialize():
gi.repository.GLib.GError: g-invoke-error-quark: Could not locate gexiv2_initialize: dlopen(./gexiv2/libgexiv2.2.dylib, 9): image not found (1)

On my system, the relevant library is at:

$ locate libgexiv2.2.dylib
/opt/local/lib/libgexiv2.2.dylib

so it appears that it is trying to load from the wrong location, perhaps.

comment:3 Changed 3 years ago by kencu (Ken)

That looks like a temporary path used during the build/test phase that never was overwritted when installed.

comment:4 Changed 3 years ago by kencu (Ken)

If it is related to gobject-introspection, and it looks like it is, there have been many changes in that setup/PG/software over the past year. You might try rebuilding gexiv2 and/or gramps (or both, in that order) from source and see what happens.

comment:5 Changed 3 years ago by ctreleaven (Craig Treleaven)

Cc: ctreleaven added

comment:6 Changed 3 years ago by ctreleaven (Craig Treleaven)

I have rebuilt gexiv2 with no improvement. I'll try rebuilding gramps but it seems unlikely to fix the problem. I'll also try forcing a local build of gobject-introspection. (BTW, I migrated to this machine, with a new OS, in February 2021.)

Weirdly, I installed gramps on another older machine and it does not exhibit these problems.

There seem to have been a variety of tickets over the past half year (?) concerning gobject-introspection and g-ir-scanner in particular. Is there one that has a good summary of the problems and the current state of our fixes?

comment:7 Changed 3 years ago by kencu (Ken)

Not really. It's a collection of python code with linker assumptions done by people who don't primarily use macOS.

Even trying to debug it is a huge headache.

Last edited 3 years ago by kencu (Ken) (previous) (diff)

comment:8 Changed 2 years ago by evanmiller (Evan Miller)

Resolution: fixed
Status: assignedclosed

In ab1765536b79f2c7dbf3ea737ea4626ad1ac90a2/macports-ports (master):

gexiv2: update to 0.14.0

Closes: #58122

comment:9 Changed 2 years ago by ctreleaven (Craig Treleaven)

That fixed my Gramps issue. Thanks!!

Note: See TracTickets for help on using tickets.