diff --git a/gramps/gen/datehandler/_grampslocale.py b/gramps/gen/datehandler/_grampslocale.py index c398f518f..1190f03e9 100644 --- a/gramps/gen/datehandler/_grampslocale.py +++ b/gramps/gen/datehandler/_grampslocale.py @@ -43,6 +43,7 @@ else: #locale returns unicode in python 3 to_uni = lambda x, y: x codeset = glocale.encoding + try: month_to_int = { diff --git a/gramps/gen/utils/cast.py b/gramps/gen/utils/cast.py index 75c5f2a9f..684137b24 100644 --- a/gramps/gen/utils/cast.py +++ b/gramps/gen/utils/cast.py @@ -36,6 +36,7 @@ import locale import sys import logging LOG = logging.getLogger(".") + #------------------------------------------------------------------------- # # Gramps modules diff --git a/gramps/gen/utils/configmanager.py b/gramps/gen/utils/configmanager.py index f504c06b9..5b19c8e20 100644 --- a/gramps/gen/utils/configmanager.py +++ b/gramps/gen/utils/configmanager.py @@ -47,6 +47,7 @@ import io from ..constfunc import STRTYPE from ..const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().gettext + def safe_eval(exp): # restrict eval to empty environment return eval(exp, {}) diff --git a/gramps/gen/utils/image.py b/gramps/gen/utils/image.py index 5a6b0a24e..85cf4b12b 100644 --- a/gramps/gen/utils/image.py +++ b/gramps/gen/utils/image.py @@ -277,4 +277,3 @@ def resize_to_jpeg_buffer(source, size, crop=None): except: pass return data - diff --git a/gramps/gui/widgets/grampletbar.py b/gramps/gui/widgets/grampletbar.py index 76df4e661..a348d94e1 100644 --- a/gramps/gui/widgets/grampletbar.py +++ b/gramps/gui/widgets/grampletbar.py @@ -56,6 +56,7 @@ from gi.repository import Gtk #------------------------------------------------------------------------- from gramps.gen.const import URL_MANUAL_PAGE, VERSION_DIR from gramps.gen.config import config +from gramps.gen.constfunc import win from ..managedwindow import ManagedWindow from ..display import display_help, display_url from .grampletpane import (AVAILABLE_GRAMPLETS, @@ -191,7 +192,10 @@ class GrampletBar(Gtk.Notebook): """ filename = self.configfile try: - fp = open(filename, "w") + if win() and not sys.version_info[0] < 3: + fp = open(filename, "w", encoding='utf-8') + else: + fp = open(filename, "w") except IOError: print("Failed writing '%s'; gramplets not saved" % filename) return