diff --git a/gramps/plugins/docgen/odfdoc.py b/gramps/plugins/docgen/odfdoc.py index 30e073b7f..6e07d46f1 100644 --- a/gramps/plugins/docgen/odfdoc.py +++ b/gramps/plugins/docgen/odfdoc.py @@ -1017,7 +1017,10 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc): return not_extension, extension = os.path.splitext(file_name) - odf_name = md5(file_name).hexdigest() + extension + file_name_hash = file_name + if sys.version_info[0] >= 3: + file_name_hash = file_name_hash.encode('utf-8') + odf_name = md5(file_name_hash).hexdigest() + extension media_list_item = (file_name, odf_name) if not media_list_item in self.media_list: @@ -1180,7 +1183,9 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc): """ Add a zip file to an archive """ - zipinfo = zipfile.ZipInfo(name.encode('utf-8')) + if sys.version_info[0] < 3: + name = name.encode('utf-8') + zipinfo = zipfile.ZipInfo(name) zipinfo.date_time = t zipinfo.compress_type = zipfile.ZIP_DEFLATED zipinfo.external_attr = 0o644 << 16