Add no-op stderr when running as Windows GUI (#222)

This commit is contained in:
Chidi Williams 2022-12-09 00:05:48 +00:00 committed by GitHub
commit fe7bdf9e6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ import multiprocessing
import os
import platform
import sys
from typing import TextIO
from appdirs import user_log_dir
@ -11,6 +12,11 @@ from appdirs import user_log_dir
if getattr(sys, 'frozen', False) is False:
faulthandler.enable()
# Sets stderr to no-op TextIO when None (run as Windows GUI).
# Resolves https://github.com/chidiwilliams/buzz/issues/221
if sys.stderr is None:
sys.stderr = TextIO()
# Adds the current directory to the PATH, so the ffmpeg binary get picked up:
# https://stackoverflow.com/a/44352931/9830227