diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index eadc5d7ec..4351699b6 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -3580,7 +3580,7 @@ def print_debug_header(self): def get_encoding(stream): ret = str(getattr(stream, 'encoding', 'missing (%s)' % type(stream).__name__)) if not supports_terminal_sequences(stream): - from .compat import WINDOWS_VT_MODE + from .compat import WINDOWS_VT_MODE # Must be imported locally ret += ' (No VT)' if WINDOWS_VT_MODE is False else ' (No ANSI)' return ret diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 0171394fc..7faee62ac 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -1851,6 +1851,10 @@ def write_string(s, out=None, encoding=None): assert isinstance(s, str) out = out or sys.stderr + from .compat import WINDOWS_VT_MODE # Must be imported locally + if WINDOWS_VT_MODE: + s = s.replace('\n', ' \n') + if 'b' in getattr(out, 'mode', ''): byt = s.encode(encoding or preferredencoding(), 'ignore') out.write(byt)