diff --git a/gramps/gen/plug/utils.py b/gramps/gen/plug/utils.py index 7a352155d..77bd5d14c 100644 --- a/gramps/gen/plug/utils.py +++ b/gramps/gen/plug/utils.py @@ -35,7 +35,7 @@ import os if sys.version_info[0] < 3: from StringIO import StringIO else: - from io import StringIO + from io import StringIO, BytesIO #------------------------------------------------------------------------- # @@ -219,7 +219,11 @@ def load_addon_file(path, callback=None): callback(_("Unable to open '%s'") % path) return try: - buffer = StringIO(fp.read()) + content = fp.read() + if sys.version_info[0] < 3: + buffer = StringIO(content) + else: + buffer = BytesIO(content) except: if callback: callback(_("Error in reading '%s'") % path) diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 6ecb2bc32..03999e968 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -397,13 +397,15 @@ class ViewManager(CLIManager): lines = list(fp.readlines()) count = 0 for line in lines: + if sys.version_info[0] >= 3: + line = line.decode('utf-8').replace(": u'", ": '") try: plugin_dict = safe_eval(line) if type(plugin_dict) != type({}): raise TypeError("Line with addon metadata is not " "a dictionary") except: - LOG.debug("Skipped a line in the addon listing: " + + LOG.warning("Skipped a line in the addon listing: " + str(line)) continue id = plugin_dict["i"]