projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
72f9767
)
correct to_stderr
author
Philipp Hagemeister
<phihag@phihag.de>
Tue, 27 Nov 2012 23:33:38 +0000
(
00:33
+0100)
committer
Philipp Hagemeister
<phihag@phihag.de>
Tue, 27 Nov 2012 23:33:38 +0000
(
00:33
+0100)
youtube_dl/FileDownloader.py
patch
|
blob
|
history
diff --git
a/youtube_dl/FileDownloader.py
b/youtube_dl/FileDownloader.py
index f1931b04dfbdca5834976f07ff5a4a3e680519bd..2b76a3b09b16b9bf5bcd4c37e22fb32ccc1aae71 100644
(file)
--- a/
youtube_dl/FileDownloader.py
+++ b/
youtube_dl/FileDownloader.py
@@
-185,7
+185,10
@@
class FileDownloader(object):
def to_stderr(self, message):
"""Print message to stderr."""
assert type(message) == type(u'')
def to_stderr(self, message):
"""Print message to stderr."""
assert type(message) == type(u'')
- sys.stderr.write((message + u'\n').encode(preferredencoding()))
+ output = message + u'\n'
+ 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())
+ sys.stderr.write(output)
def to_cons_title(self, message):
"""Set console/terminal window title to message."""
def to_cons_title(self, message):
"""Set console/terminal window title to message."""