aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sawicki <contact@grub4k.xyz>2023-03-07 22:34:07 +0100
committerGitHub <noreply@github.com>2023-03-07 22:34:07 +0100
commit3b479100df02e20dd949e046003ae96ddbfced57 (patch)
treea81e8249f256a3ca8c698f76a1dec69b403dfeda
parentd4e6ef40772e0560a8ed33b844ef7549e86837be (diff)
downloadhypervideo-pre-3b479100df02e20dd949e046003ae96ddbfced57.tar.lz
hypervideo-pre-3b479100df02e20dd949e046003ae96ddbfced57.tar.xz
hypervideo-pre-3b479100df02e20dd949e046003ae96ddbfced57.zip
[utils] `write_string`: Fix noconsole behavior
Ref: https://github.com/pyinstaller/pyinstaller/pull/7217 Authored by: Grub4K
-rw-r--r--yt_dlp/utils.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index e9b889447..8c2c5593c 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -2057,6 +2057,9 @@ def get_windows_version():
def write_string(s, out=None, encoding=None):
assert isinstance(s, str)
out = out or sys.stderr
+ # `sys.stderr` might be `None` (Ref: https://github.com/pyinstaller/pyinstaller/pull/7217)
+ if not out:
+ return
if compat_os_name == 'nt' and supports_terminal_sequences(out):
s = re.sub(r'([\r\n]+)', r' \1', s)