1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-04-08 07:58:24 -05:00

[core] Fix attribute error on failed VT init ()

Authored by: Grub4K
This commit is contained in:
Simon Sawicki 2025-03-22 21:03:28 +01:00 committed by GitHub
parent e2dfccaf80
commit b872ffec50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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(