mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-27 21:59:17 +01:00
[YoutubeDL] Make sure we really, really get out the encoding string
Fixes #3326 Apparently, on some platforms, even outputting this fails already.
This commit is contained in:
parent
c081b35c27
commit
b0472057a3
1 changed files with 11 additions and 4 deletions
|
@ -1234,14 +1234,21 @@ class YoutubeDL(object):
|
|||
if not self.params.get('verbose'):
|
||||
return
|
||||
|
||||
write_string(
|
||||
encoding_str = (
|
||||
'[debug] Encodings: locale %s, fs %s, out %s, pref %s\n' % (
|
||||
locale.getpreferredencoding(),
|
||||
sys.getfilesystemencoding(),
|
||||
sys.stdout.encoding,
|
||||
self.get_encoding()),
|
||||
encoding=None
|
||||
)
|
||||
self.get_encoding()))
|
||||
try:
|
||||
write_string(encoding_str, encoding=None)
|
||||
except:
|
||||
errmsg = 'Failed to write encoding string %r' % encoding_str
|
||||
try:
|
||||
sys.stdout.write(errmsg)
|
||||
except:
|
||||
pass
|
||||
raise IOError(errmsg)
|
||||
|
||||
self._write_string('[debug] youtube-dl version ' + __version__ + '\n')
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue