From e71115af1b880c6c732d9ef98fc14664d4c6e6ae Mon Sep 17 00:00:00 2001 From: kulath Date: Thu, 18 Jun 2015 20:25:33 +0100 Subject: [PATCH] 8614: pickleupgrade.txt should not be written for python2 --- gramps/gen/db/write.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/gramps/gen/db/write.py b/gramps/gen/db/write.py index ddb5c4587..7620d1d0a 100644 --- a/gramps/gen/db/write.py +++ b/gramps/gen/db/write.py @@ -2471,16 +2471,14 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback): with open(versionpath, "w") as version_file: version_file.write(version) - versionpath = os.path.join(name, cuni(PCKVERSFN)) - with open(versionpath, "w") as version_file: - if sys.version_info[0] <3: - version = "No" - if isinstance(version, UNITYPE): - version = version.encode('utf-8') - else: - version = "Yes" + # The pickle upgrade file is not written for Python2; its contents is + # never actually examined, all that matters is whether it is present + if sys.version_info[0] >= 3: + versionpath = os.path.join(name, cuni(PCKVERSFN)) _LOG.debug("Write pickle version file to %s" % "Yes") - version_file.write(version) + with open(versionpath, "w") as version_file: + version = "Yes" + version_file.write(version) versionpath = os.path.join(name, cuni(SCHVERSFN)) _LOG.debug("Write schema version file to %s" % str(_DBVERSION))