From 5a4b968e3b7f49bdc8abb6e107ab20c2a65c206d Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 28 Apr 2017 12:41:47 +0200 Subject: [PATCH] sys.stdin can be None in which case we can't check if it's a tty or read from it --- notebook/notebookapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 839102cddb..3985316f09 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -1206,7 +1206,7 @@ def init_terminals(self): log("Terminals not available (error was %s)", e) def init_signal(self): - if not sys.platform.startswith('win') and sys.stdin.isatty(): + if not sys.platform.startswith('win') and sys.stdin and sys.stdin.isatty(): signal.signal(signal.SIGINT, self._handle_sigint) signal.signal(signal.SIGTERM, self._signal_stop) if hasattr(signal, 'SIGUSR1'):