From 0ac8789ad5bd510b30ff73c782d46e0120985156 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 18 Oct 2013 15:21:54 +0900 Subject: [PATCH] encode to utf8 before writing log --- aqt/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aqt/main.py b/aqt/main.py index 6efd166ff..3644df94e 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -867,10 +867,10 @@ the problem and restart Anki.""") return pprint.pformat(x) path, num, fn, y = traceback.extract_stack( 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])) 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"): print buf