From 3784495d5851cd7d396987202087266b06adf7ab Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Sun, 8 May 2022 12:30:28 -0500 Subject: [PATCH] Check that channels exist before asking if they are alive --- jupyter_client/client.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jupyter_client/client.py b/jupyter_client/client.py index 5ffa069d9..c70e30b70 100644 --- a/jupyter_client/client.py +++ b/jupyter_client/client.py @@ -337,11 +337,11 @@ def stop_channels(self) -> None: def channels_running(self) -> bool: """Are any of the channels created and running?""" return ( - self.shell_channel.is_alive() - or self.iopub_channel.is_alive() - or self.stdin_channel.is_alive() - or self.hb_channel.is_alive() - or self.control_channel.is_alive() + (self._shell_channel and self.shell_channel.is_alive()) + or (self._iopub_channel and self.iopub_channel.is_alive()) + or (self._stdin_channel and self.stdin_channel.is_alive()) + or (self._hb_channel and self.hb_channel.is_alive()) + or (self._control_channel and self.control_channel.is_alive()) ) ioloop = None # Overridden in subclasses that use pyzmq event loop