fix: sys.stderr is None in windowed PyInstaller build
This commit is contained in:
parent
0b3b66a38b
commit
ebc9d5835a
10
main.py
10
main.py
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user