mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-04-24 15:46:34 -05:00
[core] Fix attribute error on failed VT init (#12696)
Authored by: Grub4K
This commit is contained in:
parent
e2dfccaf80
commit
b872ffec50
@ -654,19 +654,21 @@ class YoutubeDL:
|
|||||||
if not all_plugins_loaded.value:
|
if not all_plugins_loaded.value:
|
||||||
load_all_plugins()
|
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
|
stdout = sys.stderr if self.params.get('logtostderr') else sys.stdout
|
||||||
self._out_files = Namespace(
|
self._out_files = Namespace(
|
||||||
out=stdout,
|
out=stdout,
|
||||||
error=sys.stderr,
|
error=sys.stderr,
|
||||||
screen=sys.stderr if self.params.get('quiet') else stdout,
|
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('no_color'):
|
||||||
if self.params.get('color') is not None:
|
if self.params.get('color') is not None:
|
||||||
self.params.setdefault('_warnings', []).append(
|
self.params.setdefault('_warnings', []).append(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user