jupyter_server icon indicating copy to clipboard operation
jupyter_server copied to clipboard

'NoneType' object has no attribute 'kernel_ws_protocol'

Open Carreau opened this issue 2 years ago • 3 comments

Description

<tornado internals>
jupyter_server/jupyter_server/services/kernels/websocket.py", line 87, in select_subprotocol
        preferred_protocol = self.connection.kernel_ws_protocol
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: 'NoneType' object has no attribute 'kernel_ws_protocol'

Reproduce

I have a custom kernel (https://github.com/carreau/inplace_restarter), and trying to use it sometime logs this error in the terminal.

It looks like self.connection is None,

It itself is set from

    @property
    def kernel_websocket_connection_class(self):
        """The kernel websocket connection class."""
        return self.settings.get("kernel_websocket_connection_class")

Which I guess returns None ?

Expected behavior

Handle it being None, or raise a better/earlier error message

Carreau avatar Apr 26 '23 13:04 Carreau