From 1468f318f8ee80bfc820bcfafddec06bf2462b40 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 5 Nov 2020 22:00:36 -0800 Subject: [PATCH] Handle sys.stdin, stdout are None under pythonw. --- voussoirkit/pipeable.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/voussoirkit/pipeable.py b/voussoirkit/pipeable.py index 8583559..ba7452c 100644 --- a/voussoirkit/pipeable.py +++ b/voussoirkit/pipeable.py @@ -7,8 +7,9 @@ CLIPBOARD_STRINGS = ['!c', '!clip', '!clipboard'] INPUT_STRINGS = ['!i', '!in', '!input', '!stdin'] EOF = '\x1a' -IN_PIPE = not sys.stdin.isatty() -OUT_PIPE = not sys.stdout.isatty() +# In pythonw, stdin and stdout are None. +IN_PIPE = (sys.stdin is not None) and (not sys.stdin.isatty()) +OUT_PIPE = (sys.stdout is not None) and (not sys.stdout.isatty()) class PipeableException(Exception): pass