changeset 74:b37ca4131a04

Use binary read for stdin on python3
author Pete Schwamb <pete@schwamb.net>
date Tue, 11 Sep 2018 08:58:49 -0500
parents 60854b74ee5d
children 25d479e4ddb2
files auditok/io.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/auditok/io.py	Sun Feb 05 12:06:04 2017 +0100
+++ b/auditok/io.py	Tue Sep 11 08:58:49 2018 -0500
@@ -417,7 +417,10 @@
             raise IOError("Stream is not open")
 
         to_read = size * self.sample_width * self.channels
-        data = sys.stdin.read(to_read)
+        if sys.version_info >= (3, 0):
+            data = sys.stdin.buffer.read(to_read)
+        else:
+            data = sys.stdin.read(to_read)
 
         if data is None or len(data) < 1:
             return None