summary refs log tree commit diff
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo.valsorda@gmail.com>2013-03-28 13:13:03 +0100
committerFilippo Valsorda <filippo.valsorda@gmail.com>2013-03-28 13:13:03 +0100
commit898280a056b577c64005647cae68caf8f16ca059 (patch)
tree27f9131649a5da237aae33f8785bdc692279ffa5
parent59b4a2f0e4ec12f4f2fa8e275d7d1469faaeb52e (diff)
downloadyoutube-dl-898280a056b577c64005647cae68caf8f16ca059.tar.gz
youtube-dl-898280a056b577c64005647cae68caf8f16ca059.tar.xz
youtube-dl-898280a056b577c64005647cae68caf8f16ca059.zip
use sys.stdout.buffer only on Python3
-rw-r--r--youtube_dl/utils.py2
1 files changed, 1 insertions, 1 deletions
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: