diff options
author | Simon Sawicki <contact@grub4k.xyz> | 2025-03-22 21:03:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-22 21:03:28 +0100 |
commit | b872ffec50fd50f790a5a490e006a369a28a3df3 (patch) | |
tree | 3406150fff4c810816c9d9915c8470fe5e2056d2 /yt_dlp/YoutubeDL.py | |
parent | e2dfccaf808b406d5bcb7dd04ae9ce420752dd6f (diff) |
[core] Fix attribute error on failed VT init (#12696)
Authored by: Grub4K
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r-- | yt_dlp/YoutubeDL.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 8790b326b..6c0b12e66 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.stdout self._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( |