1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-22 02:01:50 +00:00

[YoutubeDL] guard against strange sys.stdouts

This commit is contained in:
Philipp Hagemeister 2014-11-12 15:30:26 +01:00
parent 732c848c14
commit c6afed48ff

View file

@ -1306,11 +1306,13 @@ class YoutubeDL(object):
self.report_warning(
'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 = (
'[debug] Encodings: locale %s, fs %s, out %s, pref %s\n' % (
locale.getpreferredencoding(),
sys.getfilesystemencoding(),
sys.stdout.encoding,
stdout_encoding,
self.get_encoding()))
write_string(encoding_str, encoding=None)