Skip to content

Commit 3784495

Browse files
committed
Check that channels exist before asking if they are alive
1 parent 63edf18 commit 3784495

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

jupyter_client/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,11 @@ def stop_channels(self) -> None:
337337
def channels_running(self) -> bool:
338338
"""Are any of the channels created and running?"""
339339
return (
340-
self.shell_channel.is_alive()
341-
or self.iopub_channel.is_alive()
342-
or self.stdin_channel.is_alive()
343-
or self.hb_channel.is_alive()
344-
or self.control_channel.is_alive()
340+
(self._shell_channel and self.shell_channel.is_alive())
341+
or (self._iopub_channel and self.iopub_channel.is_alive())
342+
or (self._stdin_channel and self.stdin_channel.is_alive())
343+
or (self._hb_channel and self.hb_channel.is_alive())
344+
or (self._control_channel and self.control_channel.is_alive())
345345
)
346346

347347
ioloop = None # Overridden in subclasses that use pyzmq event loop

0 commit comments

Comments
 (0)