diff options
-rw-r--r-- | tftpy/compat.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tftpy/compat.py b/tftpy/compat.py index 0049396..d889f74 100644 --- a/tftpy/compat.py +++ b/tftpy/compat.py @@ -1,12 +1,13 @@ import sys + def binary_stdin(): """ Get a file object for reading binary bytes from stdin instead of text. Compatible with Py2/3, POSIX & win32. Credits: https://stackoverflow.com/a/38939320/531179 (CC BY-SA 3.0) """ - if hasattr(sys.stdin, 'buffer'): # Py3+ + if hasattr(sys.stdin, 'buffer'): # Py3+ return sys.stdin.buffer else: if sys.platform == 'win32': |