mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-14 22:37:59 +09:00
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>
This commit is contained in:
parent
f10b2a9c14
commit
1ee9778405
@ -329,7 +329,7 @@ def sanitize_open(filename, open_mode):
|
|||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
import msvcrt
|
import msvcrt
|
||||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||||
return (sys.stdout, filename)
|
return (sys.stdout.buffer, filename)
|
||||||
stream = open(encodeFilename(filename), open_mode)
|
stream = open(encodeFilename(filename), open_mode)
|
||||||
return (stream, filename)
|
return (stream, filename)
|
||||||
except (IOError, OSError) as err:
|
except (IOError, OSError) as err:
|
||||||
|
Loading…
Reference in New Issue
Block a user