From 8eed6b869a1f75dbdb66f84473668687fdacd7f6 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sat, 4 Sep 2021 12:00:04 +0200 Subject: [PATCH] Solve InterpolationSyntaxError if "%" in a string The grampletpane module save data in a config file for all the gramplets added in the dashboard. The python configparser module doesn't like if we have a "%" character in a string. Fixes #012423 --- gramps/gui/widgets/grampletpane.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gramps/gui/widgets/grampletpane.py b/gramps/gui/widgets/grampletpane.py index a4773bf86..74a1f2ac4 100644 --- a/gramps/gui/widgets/grampletpane.py +++ b/gramps/gui/widgets/grampletpane.py @@ -1239,6 +1239,12 @@ class GrampletPane(Gtk.ScrolledWindow): else: cnt = 0 for item in base_opts["data"]: + # If we have a "%" in a string, + # escape it by writing "%%" + # to avoid InterpolationSyntaxError + # in python configparser module. + if isinstance(item, str): + item = item.replace("%", "%%") fp.write("data[%d]=%s\n" % (cnt, item)) cnt += 1 else: