mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Add mock stdout/stderr for console=False case on Windows
PyInstaller provided a NulWriter when running in GUI mode, but stdout/ stderr now default to None with PyOxidizer. Fixes #1786
This commit is contained in:
parent
a99253b990
commit
0b2a226dc8
1 changed files with 4 additions and 2 deletions
|
@ -59,8 +59,10 @@ try:
|
|||
sys.stdout.reconfigure(encoding="utf-8") # type: ignore
|
||||
sys.stderr.reconfigure(encoding="utf-8") # type: ignore
|
||||
except AttributeError:
|
||||
# on Windows without console, NullWriter doesn't support this
|
||||
pass
|
||||
if is_win:
|
||||
# On Windows without console; add a mock writer. The stderr
|
||||
# writer will be overwritten when ErrorHandler is initialized.
|
||||
sys.stderr = sys.stdout = open(os.devnull, "w", encoding="utf8")
|
||||
|
||||
appVersion = _version
|
||||
appWebsite = "https://apps.ankiweb.net/"
|
||||
|
|
Loading…
Reference in a new issue