diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2012-11-27 13:10:57 -0800 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2012-11-27 13:10:57 -0800 |
commit | 18ea0cefc370807e1d31fd7b462691f29f48c8fe (patch) | |
tree | cc03a75226844bb107851d08f467586ca6b458a9 | |
parent | 95649b3936e10a48c4a5009eecfb7647756bde39 (diff) | |
parent | c806f804d85dc53f08b1a13d9cfdbe0a8eb58b15 (diff) |
Merge pull request #560 from phihag/fix-to_screen-mode
to_screen: Only encode when output stream is binary
-rw-r--r-- | youtube_dl/FileDownloader.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/youtube_dl/FileDownloader.py b/youtube_dl/FileDownloader.py index 6d52dc923..4e9b55f49 100644 --- a/youtube_dl/FileDownloader.py +++ b/youtube_dl/FileDownloader.py @@ -179,7 +179,7 @@ class FileDownloader(object): 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() |