mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-12-22 15:57:23 +00:00
correct to_stderr
This commit is contained in:
parent
72f976701a
commit
64a57846d3
1 changed files with 4 additions and 1 deletions
|
@ -185,7 +185,10 @@ class FileDownloader(object):
|
||||||
def to_stderr(self, message):
|
def to_stderr(self, message):
|
||||||
"""Print message to stderr."""
|
"""Print message to stderr."""
|
||||||
assert type(message) == type(u'')
|
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):
|
def to_cons_title(self, message):
|
||||||
"""Set console/terminal window title to message."""
|
"""Set console/terminal window title to message."""
|
||||||
|
|
Loading…
Reference in a new issue