1

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 Answer 1

2

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()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.