aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-09-16 06:55:33 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-09-16 06:55:41 +0200
commit7459e3a29081dfa4cbbcc795e054e884e1d5e020 (patch)
tree2705a0a0fbcc03e6ab3d0c278f4b0b8c59d9a44f /youtube_dl/YoutubeDL.py
parentf9e66fb99367b5ccac3f0c1c61441ed52d787836 (diff)
Always correct encoding when writing to sys.stderr (Fixes #1435)
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r--youtube_dl/YoutubeDL.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index e53a2b8ad..de2b133e0 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -142,14 +142,10 @@ class YoutubeDL(object):
def to_screen(self, message, skip_eol=False):
"""Print message to stdout if not in quiet mode."""
- assert type(message) == type(u'')
if not self.params.get('quiet', False):
terminator = [u'\n', u''][skip_eol]
output = message + terminator
- 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()
+ write_string(output, self._screen_file)
def to_stderr(self, message):
"""Print message to stderr."""