mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
fix error when writing to deleted.txt
This commit is contained in:
parent
9fbdca26a4
commit
e2573d6a1a
1 changed files with 4 additions and 4 deletions
|
@ -895,15 +895,15 @@ and if the problem comes up again, please ask on the support site."""))
|
||||||
def onRemNotes(self, col, nids):
|
def onRemNotes(self, col, nids):
|
||||||
path = os.path.join(self.pm.profileFolder(), "deleted.txt")
|
path = os.path.join(self.pm.profileFolder(), "deleted.txt")
|
||||||
existed = os.path.exists(path)
|
existed = os.path.exists(path)
|
||||||
with open(path, "a") as f:
|
with open(path, "ab") as f:
|
||||||
if not existed:
|
if not existed:
|
||||||
f.write("nid\tmid\tfields\n")
|
f.write(b"nid\tmid\tfields\n")
|
||||||
for id, mid, flds in col.db.execute(
|
for id, mid, flds in col.db.execute(
|
||||||
"select id, mid, flds from notes where id in %s" %
|
"select id, mid, flds from notes where id in %s" %
|
||||||
ids2str(nids)):
|
ids2str(nids)):
|
||||||
fields = splitFields(flds)
|
fields = splitFields(flds)
|
||||||
f.write(("\t".join([str(id), str(mid)] + fields)))
|
f.write(("\t".join([str(id), str(mid)] + fields)).encode("utf8"))
|
||||||
f.write("\n")
|
f.write(b"\n")
|
||||||
|
|
||||||
# Schema modifications
|
# Schema modifications
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
Loading…
Reference in a new issue