Skip to content

Client exception when using jupyter-client >= 7.0: 'coroutine' object is not subscriptable #8

@Dalbasar

Description

@Dalbasar

When connecting to a background zmq ipython kernel using jupyter console --existing when jupyter-client>=7.0 is installed leads to a RuntimeWarning.

\bzmqipython\lib\site-packages\zmq_future.py:591: RuntimeWarning: Proactor event loop does not implement add_reader family of methods required for zmq. Registering an additional selector thread for add_reader support via tornado. Use asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy()) to avoid this warning.
self._get_loop()
Jupyter console 6.4.0

Python 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.1 -- An enhanced Interactive Python. Type '?' for help.

Hello from background-zmq-ipython.
In [1]:

Sending any command results in a 'coroutine' object is not subscriptable exception:

In [1]: x = 1
\bzmqipython\lib\site-packages\jupyter_console\ptshell.py:852: RuntimeWarning: coroutine 'ZMQSocketChannel.msg_ready' was never awaited
while self.client.iopub_channel.msg_ready():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Unhandled exception in event loop:
File "\AppData\Local\Programs\Python\Python39\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "\bzmqipython\lib\site-packages\prompt_toolkit\input\win32.py", line 613, in ready
callback()
File "\bzmqipython\lib\site-packages\prompt_toolkit\application\application.py", line 690, in read_from_input
self.key_processor.process_keys()
File "\bzmqipython\lib\site-packages\prompt_toolkit\key_binding\key_processor.py", line 271, in process_keys
self._process_coroutine.send(key_press)
File "\bzmqipython\lib\site-packages\prompt_toolkit\key_binding\key_processor.py", line 186, in _process
self._call_handler(matches[-1], key_sequence=buffer[:])
File "\bzmqipython\lib\site-packages\prompt_toolkit\key_binding\key_processor.py", line 321, in _call_handler
handler.call(event)
File "\bzmqipython\lib\site-packages\prompt_toolkit\key_binding\key_bindings.py", line 124, in call
result = self.handler(event)
File "\bzmqipython\lib\site-packages\jupyter_console\ptshell.py", line 475, in _
self.handle_iopub()
File "\bzmqipython\lib\site-packages\jupyter_console\ptshell.py", line 854, in handle_iopub
msg_type = sub_msg['header']['msg_type']

Exception 'coroutine' object is not subscriptable
Press ENTER to continue...

I am using Python 3.9.9 on Windows 10 64bit and with jupyter-client==6.1.12 (and ipykernel==5.5.6) it works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions