mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
encode to utf8 before writing log
This commit is contained in:
parent
313fc7c9ef
commit
0ac8789ad5
1 changed files with 2 additions and 2 deletions
|
@ -867,10 +867,10 @@ the problem and restart Anki.""")
|
||||||
return pprint.pformat(x)
|
return pprint.pformat(x)
|
||||||
path, num, fn, y = traceback.extract_stack(
|
path, num, fn, y = traceback.extract_stack(
|
||||||
limit=4+kwargs.get("stack", 0))[0]
|
limit=4+kwargs.get("stack", 0))[0]
|
||||||
buf = "[%s] %s:%s(): %s" % (intTime(), os.path.basename(path), fn,
|
buf = u"[%s] %s:%s(): %s" % (intTime(), os.path.basename(path), fn,
|
||||||
", ".join([customRepr(x) for x in args]))
|
", ".join([customRepr(x) for x in args]))
|
||||||
lpath = re.sub("\.anki2$", ".log", self.pm.collectionPath())
|
lpath = re.sub("\.anki2$", ".log", self.pm.collectionPath())
|
||||||
open(lpath, "ab").write(buf + "\n")
|
open(lpath, "ab").write(buf.encode("utf8") + "\n")
|
||||||
if os.environ.get("LOG"):
|
if os.environ.get("LOG"):
|
||||||
print buf
|
print buf
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue