1
votes

I'm trying to interact with a running ipython kernel through a python shell, using the jupyter_client package.

I have the kernel running, with a connection file (e.g. "kernel-7772.json") sitting in %APPDATA%\jupyter\runtime.

The code I run is the following:

import jupyter_client
cf = jupyter_client.find_connection_file('7772')
km = jupyter_client.KernelClient(connection_file = cf)
km.load_connection_file()
km.start_channels()

And then I get the error TypeError: ChannelABC() takes no arguments

(full traceback:

File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\client.py", line 101 in start_channels
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\client.py", line 143 in shell_channel
    socket, self.session, self.ioloop

)

I also tried using BlockingKernelClient, which works completely without issues. However, I would prefer to use the non-blocking KernelClient. Am I doing something wrong? Is there a bug in KernelClient?

My jupyter_client version is 5.3.1 and I'm using python 3.7.3.

1

1 Answers

1
votes

KernelClient is an abstract class. The solution is to use AsyncKernelClient instead.

import jupyter_client
cf = jupyter_client.find_connection_file('7772')
km = jupyter_client.AsyncKernelClient(connection_file = cf)
km.load_connection_file()
km.start_channels()