aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-10-23 12:22:42 +0200
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>2010-10-31 11:28:45 +0100
commite08878f498c69567b213d781da02187869285a5f (patch)
tree8e07a37092295d228bd5c6a30cfd3024ec551bb7
parenta949a3ae6bda6efa3abc3770e49be34653cc613b (diff)
Set stdout to binary mode under Windows (fixes issue #218)
-rwxr-xr-xyoutube-dl3
1 files changed, 3 insertions, 0 deletions
diff --git a/youtube-dl b/youtube-dl
index 094a4164c..8494be96c 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -94,6 +94,9 @@ def sanitize_open(filename, open_mode):
"""
try:
if filename == u'-':
+ if sys.platform == 'win32':
+ import msvcrt
+ msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
return (sys.stdout, filename)
stream = open(filename, open_mode)
return (stream, filename)