From e2573d6a1a3b50e7089ee2661da3d5ad65fa43c3 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 8 Jan 2017 20:44:52 +1000 Subject: [PATCH] fix error when writing to deleted.txt --- aqt/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/aqt/main.py b/aqt/main.py index 384f7fa3e..24ea6d27e 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -895,15 +895,15 @@ and if the problem comes up again, please ask on the support site.""")) def onRemNotes(self, col, nids): path = os.path.join(self.pm.profileFolder(), "deleted.txt") existed = os.path.exists(path) - with open(path, "a") as f: + with open(path, "ab") as f: if not existed: - f.write("nid\tmid\tfields\n") + f.write(b"nid\tmid\tfields\n") for id, mid, flds in col.db.execute( "select id, mid, flds from notes where id in %s" % ids2str(nids)): fields = splitFields(flds) - f.write(("\t".join([str(id), str(mid)] + fields))) - f.write("\n") + f.write(("\t".join([str(id), str(mid)] + fields)).encode("utf8")) + f.write(b"\n") # Schema modifications ##########################################################################