diff options
author | Christopher Rosell <chrippa@tanuki.se> | 2012-09-26 14:28:09 +0200 |
---|---|---|
committer | Christopher Rosell <chrippa@tanuki.se> | 2012-09-26 14:28:09 +0200 |
commit | b69a3f96455f3333bc70b67f828cda784fc4ac99 (patch) | |
tree | 41b38d25f3573cbffd3afbd5ec675f162034c0ca | |
parent | 0a981dc25b52f234a459d613c3084af3abc81763 (diff) |
Fix file check on Python 3.
-rw-r--r-- | src/livestreamer/cli.py | 4 | ||||
-rw-r--r-- | src/livestreamer/compat.py | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/livestreamer/cli.py b/src/livestreamer/cli.py index 217ee52..d2a31f6 100644 --- a/src/livestreamer/cli.py +++ b/src/livestreamer/cli.py @@ -5,7 +5,7 @@ import sys import subprocess from livestreamer import * -from livestreamer.compat import input, stdout, is_win32 +from livestreamer.compat import input, stdout, file, is_win32 from livestreamer.stream import StreamProcess from livestreamer.utils import ArgumentParser, NamedPipe @@ -217,7 +217,7 @@ def output_stream(stream, args): if not out: exit("Failed to open a valid stream output") - if is_win32 and type(out) is file: + if is_win32 and isinstance(out, file): import msvcrt msvcrt.setmode(out.fileno(), os.O_BINARY) diff --git a/src/livestreamer/compat.py b/src/livestreamer/compat.py index d91021f..f32fe47 100644 --- a/src/livestreamer/compat.py +++ b/src/livestreamer/compat.py @@ -10,6 +10,7 @@ if is_py2: stdout = sys.stdout _str = str str = unicode + file = file def bytes(b, enc="ascii"): return _str(b) @@ -19,6 +20,7 @@ elif is_py3: input = input stdout = sys.stdout.buffer str = str + from io import IOBase as file try: from urllib.parse import urlparse, urljoin, quote, unquote, parse_qs |