Use sys.stdout.buffer instead of sys.stdout

sys.stdout defaults to text mode, we need to use the underlying buffer
instead when writing binary data.

Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com>
pull/762/head
Chirantan Ekbote 2013-03-27 15:57:11 -04:00
rodzic f10b2a9c14
commit 1ee9778405
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -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, filename)
return (sys.stdout.buffer, filename)
stream = open(encodeFilename(filename), open_mode)
return (stream, filename)
except (IOError, OSError) as err: