From cf1d6a55a323fd3f1f9ec954b99e897ea7dfee5f Mon Sep 17 00:00:00 2001 From: bruor Date: Tue, 4 Jun 2019 10:23:54 -0400 Subject: [PATCH] add execption handling for isatty() --- py-kms/pykms_Format.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/py-kms/pykms_Format.py b/py-kms/pykms_Format.py index a851cc0..fdf4bfe 100644 --- a/py-kms/pykms_Format.py +++ b/py-kms/pykms_Format.py @@ -187,8 +187,11 @@ class ShellMessage(object): if sys.stdout.isatty(): print(toprint) else: - from pykms_GuiBase import gui_redirect # Import after variables creation. - gui_redirect(toprint) + try: + from pykms_GuiBase import gui_redirect # Import after variables creation. + gui_redirect(toprint) + except: + print(toprint) def spawn(self): # Save everything that would otherwise go to stdout.