From b240c31631665f00cef5badd66fef6872b015765 Mon Sep 17 00:00:00 2001 From: Josip Date: Fri, 4 Apr 2014 21:47:39 +0200 Subject: [PATCH] 7258: transcode os.path.join args from the fs enc to prevent a crash --- gramps/gen/recentfiles.py | 4 ++-- gramps/gui/aboutdialog.py | 3 ++- setup.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gramps/gen/recentfiles.py b/gramps/gen/recentfiles.py index d25a30a78..346bbbc5e 100644 --- a/gramps/gen/recentfiles.py +++ b/gramps/gen/recentfiles.py @@ -184,7 +184,7 @@ class RecentFiles(object): """ Saves the current GRAMPS RecentFiles collection to the associated file. """ - with open(os.path.expanduser(GRAMPS_FILENAME), 'w') as xml_file: + with open(os.path.expanduser(GRAMPS_FILENAME), 'w', encoding='utf8') as xml_file: if use_lock: fcntl.lockf(xml_file,fcntl.LOCK_EX) xml_file.write("\n") @@ -222,7 +222,7 @@ class RecentParser(object): try: # Python3's expat wants bytes, Python2's wants a string. fmode = "r" if sys.version_info[0] < 3 else "rb" - with open(fname, fmode) as xml_file: + with io.open(fname, fmode) as xml_file: if use_lock: fcntl.lockf(xml_file,fcntl.LOCK_SH) diff --git a/gramps/gui/aboutdialog.py b/gramps/gui/aboutdialog.py index 7dbc94048..1067a8cee 100644 --- a/gramps/gui/aboutdialog.py +++ b/gramps/gui/aboutdialog.py @@ -32,6 +32,7 @@ from __future__ import unicode_literals import os import sys +import io ##import logging ##_LOG = logging.getLogger(".GrampsAboutDialog") @@ -229,7 +230,7 @@ def _get_authors(): parser = make_parser() parser.setContentHandler(AuthorParser(authors, contributors)) - authors_file = open(AUTHORS_FILE) + authors_file = io.open(AUTHORS_FILE, encoding="utf-8") parser.parse(authors_file) authors_file.close() diff --git a/setup.py b/setup.py index fc3c3f029..1fb60265e 100644 --- a/setup.py +++ b/setup.py @@ -214,7 +214,7 @@ def merge(in_file, out_file, option, po_dir='po', cache=True): if (not os.path.exists(out_file) and os.path.exists(in_file)): if sys.platform == 'win32': - cmd = (('set LC_ALL=C && intltool-merge %(opt)s %(po_dir)s %(in_file)s ' + cmd = (('set LC_ALL=C && perl -S intltool-merge %(opt)s %(po_dir)s %(in_file)s ' '%(out_file)s') % {'opt' : option, 'po_dir' : po_dir,