I have tried to get the jupyter_client API working, and I cannot figure it out at all.
For example. Here’s me trying to make a basic
import asyncio from jupyter_client.manager import AsyncKernelManager from queue import Empty km = AsyncKernelManager(kernel_name="python3") async def go(): await km.start_kernel() client = km.client() msg_id = client.execute("time.sleep(1)") print(msg_id) while True: try: reply = await client.get_shell_msg(timeout=1) if reply: print(reply) except Empty: print("shell empty") try: iopub_msg = await client.get_iopub_msg(timeout=1) print(iopub_msg) except Empty: print("iopub empty") pass # run async go import asyncio loop = asyncio.get_event_loop() loop.run_until_complete(go())
This just loops forever, with no messages on either the shell or iopub channel.
Additionally, the non-async version (using either the standard
KernelManager or the
BlockingKernelManager) also do not work.
What am I doing wrong?