diff options
author | Filippo Valsorda <filippo.valsorda@gmail.com> | 2013-03-28 13:13:03 +0100 |
---|---|---|
committer | Filippo Valsorda <filippo.valsorda@gmail.com> | 2013-03-28 13:13:03 +0100 |
commit | 898280a056b577c64005647cae68caf8f16ca059 (patch) | |
tree | 27f9131649a5da237aae33f8785bdc692279ffa5 /youtube_dl/utils.py | |
parent | 59b4a2f0e4ec12f4f2fa8e275d7d1469faaeb52e (diff) |
use sys.stdout.buffer only on Python3
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r-- | youtube_dl/utils.py | 2 |
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: |