A feature-rich command-line audio/video downloader
[core] Fix attribute error on failed VT init (#12696)
Simon Sawickib872ffec50fd
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex 8790b326b7..6c0b12e663 100644--- a/yt_dlp/YoutubeDL.py+++ b/yt_dlp/YoutubeDL.py@@ -654,19 +654,21 @@ class YoutubeDL:if not all_plugins_loaded.value:load_all_plugins()- try:- windows_enable_vt_mode()- except Exception as e:- self.write_debug(f'Failed to enable VT mode: {e}')-stdout = sys.stderr if self.params.get('logtostderr') else sys.stdoutself._out_files = Namespace(out=stdout,error=sys.stderr,screen=sys.stderr if self.params.get('quiet') else stdout,- console=next(filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None),)+ try:+ windows_enable_vt_mode()+ except Exception as e:+ self.write_debug(f'Failed to enable VT mode: {e}')++ # hehe "immutable" namespace+ self._out_files.console = next(filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None)+if self.params.get('no_color'):if self.params.get('color') is not None:self.params.setdefault('_warnings', []).append(