fix: sys.stderr is None in windowed PyInstaller build

This commit is contained in:
Данил Ярош 2026-03-19 15:55:14 +03:00
parent 0b3b66a38b
commit ebc9d5835a

10
main.py
View File

@ -1,6 +1,14 @@
import faulthandler
import sys
# В windowed-сборке (PyInstaller --noconsole) stdout/stderr могут быть None.
# Подменяем их на devnull, чтобы print() и faulthandler не падали.
if sys.stderr is None:
sys.stderr = open("NUL", "w") # noqa: SIM115
if sys.stdout is None:
sys.stdout = open("NUL", "w") # noqa: SIM115
import faulthandler
faulthandler.enable(file=sys.stderr)
from app.entry import main