From 7061aac16d9d9da1eab52489553fa0aae1a66535 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Wed, 15 Apr 2020 16:04:57 -0300 Subject: [PATCH] Set to javaScriptConsoleMessage output to stdout because it may raise error messages on the anki GUI. --- qt/aqt/webview.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index abb70ddc3..bb6ebc637 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -81,10 +81,12 @@ class AnkiWebPage(QWebEnginePage): # type: ignore t=level, a=line, f=srcID, b=msg + "\n" ) # ensure we don't try to write characters the terminal can't handle - buf = buf.encode(sys.stderr.encoding, "backslashreplace").decode( - sys.stderr.encoding + buf = buf.encode(sys.stdout.encoding, "backslashreplace").decode( + sys.stdout.encoding ) - sys.stderr.write(buf) + # output to stdout because it may raise error messages on the anki GUI + # https://github.com/ankitects/anki/pull/560 + sys.stdout.write(buf) def acceptNavigationRequest(self, url, navType, isMainFrame): if not isMainFrame: