1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 11:41:52 +00:00

Properly encode messages sent to stderr (fixes issue #34)

This commit is contained in:
Ricardo Garcia 2009-07-13 15:25:14 +02:00
parent 8b07dec5f6
commit 7eb0e89742

View file

@ -227,7 +227,7 @@ class FileDownloader(object):
def to_stderr(self, message): def to_stderr(self, message):
"""Print message to stderr.""" """Print message to stderr."""
print >>sys.stderr, message print >>sys.stderr, message.encode(locale.getpreferredencoding())
def fixed_template(self): def fixed_template(self):
"""Checks if the output template is fixed.""" """Checks if the output template is fixed."""
@ -308,7 +308,7 @@ class FileDownloader(object):
except (ValueError, KeyError), err: except (ValueError, KeyError), err:
self.trouble('ERROR: invalid output template or system charset: %s' % str(err)) self.trouble('ERROR: invalid output template or system charset: %s' % str(err))
if self.params['nooverwrites'] and os.path.exists(filename): if self.params['nooverwrites'] and os.path.exists(filename):
self.to_stderr('WARNING: file exists: %s; skipping' % filename) self.to_stderr(u'WARNING: file exists: %s; skipping' % filename)
return return
try: try: