diff --git a/gramps/grampsapp.py b/gramps/grampsapp.py index 4373103f0..81dd757d7 100644 --- a/gramps/grampsapp.py +++ b/gramps/grampsapp.py @@ -240,11 +240,17 @@ def show_settings(): osmgpsmap_str = 'not found' try: - from gi.repository import GExiv2 - try: - gexiv2_str = GExiv2._version - except: # any failure to 'get' the version - gexiv2_str = 'unknown version' + from gi import Repository + repository = Repository.get_default() + if repository.enumerate_versions("GExiv2"): + from gi.repository import GExiv2 + try: + gexiv2_str = GExiv2._version + except: # any failure to 'get' the version + gexiv2_str = 'unknown version' + else: + gexiv2_str = 'not found' + except ImportError: gexiv2_str = 'not found' diff --git a/gramps/plugins/gramplet/gramplet.gpr.py b/gramps/plugins/gramplet/gramplet.gpr.py index a11319ef0..bcfd565c8 100644 --- a/gramps/plugins/gramplet/gramplet.gpr.py +++ b/gramps/plugins/gramplet/gramplet.gpr.py @@ -371,12 +371,14 @@ register(GRAMPLET, ) try: - from gi.repository import GExiv2 - available = True -except: - import logging - logging.warning(_("WARNING: GExiv2 module not loaded. " - "Image metadata functionality will not be available.")) + from gi import Repository + repository = Repository.get_default() + if repository.enumerate_versions("GExiv2"): + from gi.repository import GExiv2 + available = True + else: + available = False +except ImportError: available = False if available: