From: Filippo Valsorda Date: Thu, 28 Mar 2013 12:13:03 +0000 (+0100) Subject: use sys.stdout.buffer only on Python3 X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=898280a056b577c64005647cae68caf8f16ca059;p=youtube-dl use sys.stdout.buffer only on Python3 --- diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 901b5b5ad..49af7d7c0 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -329,7 +329,7 @@ def sanitize_open(filename, open_mode): if sys.platform == 'win32': import msvcrt msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) - return (sys.stdout.buffer, filename) + return (sys.stdout.buffer if hasattr(sys.stdout, 'buffer') else sys.stdout, filename) stream = open(encodeFilename(filename), open_mode) return (stream, filename) except (IOError, OSError) as err: