diff --git a/main.py b/main.py index b780888d..579805ff 100644 --- a/main.py +++ b/main.py @@ -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