Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Dalbasar opened this issue Dec 14, 2021 · 1 comment

Comments

@Dalbasar
Copy link
Contributor

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.

@Dalbasar
Copy link
Contributor Author

Dalbasar commented Dec 14, 2021

This seems to be an upstream problem in the jupyter_console (<=6.4.0) \ jupyter_client > 7.0 modules, because it also happens when spawing an ipython kernel directly via ipython kernel in the command line.

It seems it will be fixed in jupyter_console 6.4.1, see
jupyter/jupyter_console#244
jupyter/jupyter_console#251
jupyter/jupyter_client#690

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant