mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-18 00:05:22 +01:00
[YoutubeDL] guard against strange sys.stdouts
This commit is contained in:
parent
732c848c14
commit
c6afed48ff
|
@ -1306,11 +1306,13 @@ def print_debug_header(self):
|
||||||
self.report_warning(
|
self.report_warning(
|
||||||
'Your Python is broken! Update to a newer and supported version')
|
'Your Python is broken! Update to a newer and supported version')
|
||||||
|
|
||||||
|
stdout_encoding = getattr(
|
||||||
|
sys.stdout, 'encoding', 'missing (%s)' % type(sys.stdout).__name__)
|
||||||
encoding_str = (
|
encoding_str = (
|
||||||
'[debug] Encodings: locale %s, fs %s, out %s, pref %s\n' % (
|
'[debug] Encodings: locale %s, fs %s, out %s, pref %s\n' % (
|
||||||
locale.getpreferredencoding(),
|
locale.getpreferredencoding(),
|
||||||
sys.getfilesystemencoding(),
|
sys.getfilesystemencoding(),
|
||||||
sys.stdout.encoding,
|
stdout_encoding,
|
||||||
self.get_encoding()))
|
self.get_encoding()))
|
||||||
write_string(encoding_str, encoding=None)
|
write_string(encoding_str, encoding=None)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user