diff --git a/gramps/cli/clidbman.py b/gramps/cli/clidbman.py index 89e6fd5e0..5a8ed7bc6 100644 --- a/gramps/cli/clidbman.py +++ b/gramps/cli/clidbman.py @@ -476,8 +476,6 @@ def find_next_db_dir(): while True: base = "%x" % int(time.time()) dbdir = os.path.expanduser(config.get('behavior.database-path')) - if sys.version_info[0] < 3: - dbdir = dbdir.encode(glocale.getfilesystemencoding()) new_path = os.path.join(dbdir, base) if not os.path.isdir(new_path): break diff --git a/gramps/gen/plug/docgen/graphdoc.py b/gramps/gen/plug/docgen/graphdoc.py index 0292dedd7..4401c491d 100644 --- a/gramps/gen/plug/docgen/graphdoc.py +++ b/gramps/gen/plug/docgen/graphdoc.py @@ -936,12 +936,8 @@ class GVPdfGvDoc(GVDocBase): dotfile = os.fdopen(handle, "wb") dotfile.write(self._dot.getvalue()) dotfile.close() - # Convert filename to str using file system encoding. - if sys.version_info[0] < 3: - fname = self._filename.encode(glocale.getfilesystemencoding()) - else: - fname = self._filename - + fname = self._filename + # Generate the PDF file. os.system( 'dot -Tpdf -o"%s" "%s"' % (fname, tmp_dot) ) diff --git a/gramps/gen/utils/configmanager.py b/gramps/gen/utils/configmanager.py index 1dd6ed515..3a457bf03 100644 --- a/gramps/gen/utils/configmanager.py +++ b/gramps/gen/utils/configmanager.py @@ -50,11 +50,7 @@ _ = glocale.translation.gettext def safe_eval(exp): # restrict eval to empty environment - try: - return eval(exp, {}) - except SyntaxError: - logging.warning ("Invalid command string: %s", exp) - return exp + return eval(exp, {}) ##try: ## from ast import literal_eval as safe_eval @@ -368,17 +364,9 @@ class ConfigManager(object): default = "" if isinstance(value, int): value = int(value) - # repr() in Py2 effectively runs "encode(val, - # ascii, backslashreplace)" on its argument, - # and there's no way to reconstruct the - # string, so we special-case handling writing - # to ensure the unicode is preserved. - if isinstance(value, str) or isinstance(value, unicode): - key_file.write(("%s%s=u'%s'\n") % (default, key, - value)) - else: - key_file.write(("%s%s=%s\n")% (default, key, - repr(value))) + key_file.write(("%s%s=%s\n")% (default, + key, + repr(value))) key_file.write("\n") key_file.close() # else, no filename given; nothing to save so do nothing quietly diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index fe71a3e90..ee68880f2 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -1097,8 +1097,6 @@ class ViewManager(CLIManager): value = dialog.run() if value: (filename, title) = value - if sys.version_info[0] < 3: - filename = filename.encode(glocale.getfilesystemencoding()) self.db_loader.read_file(filename) self._post_load_newdb(filename, 'x-directory/normal', title)