mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-25 23:24:30 +00:00
Merge pull request #560 from phihag/fix-to_screen-mode
to_screen: Only encode when output stream is binary
This commit is contained in:
commit
18ea0cefc3
1 changed files with 1 additions and 1 deletions
|
@ -179,7 +179,7 @@ def to_screen(self, message, skip_eol=False):
|
|||
if not self.params.get('quiet', False):
|
||||
terminator = [u'\n', u''][skip_eol]
|
||||
output = message + terminator
|
||||
if 'b' not in self._screen_file.mode or sys.version_info[0] < 3: # Python 2 lies about the mode of sys.stdout/sys.stderr
|
||||
if 'b' in getattr(self._screen_file, 'mode', '') or sys.version_info[0] < 3: # Python 2 lies about the mode of sys.stdout/sys.stderr
|
||||
output = output.encode(preferredencoding(), 'ignore')
|
||||
self._screen_file.write(output)
|
||||
self._screen_file.flush()
|
||||
|
|
Loading…
Reference in a new issue