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

Exception raised in KernelClient.del when shutting down kernel after executing code using kc.execute_interactive() #1026

Open
vivekvedant opened this issue May 30, 2024 · 2 comments

Comments

@vivekvedant
Copy link

vivekvedant commented May 30, 2024

Description
When executing the provided code snippet to start a new kernel and execute a Python statement using kc.execute_interactive, the code executes successfully, but it raises an exception related to KernelClient.del upon exiting.

Steps to Reproduce
Run the following Python code:

from jupyter_client.manager import KernelManager, start_new_kernel
from IPython.utils.capture import capture_output

km, kc = start_new_kernel(kernel_name="python3")

TIMEOUT = 30
with capture_output() as io:
    reply = kc.execute_interactive("print('hello world')", timeout=TIMEOUT)
km.shutdown_kernel()

print(io.stdout)
print(io.stderr)

Expected Behavior
The code should execute the provided Python statement (print('hello world')) in the newly started kernel and print "hello world" to the standard output. After execution, it should cleanly exit without raising any exceptions.

Actual Behavior
The code executes successfully and prints "hello world" as expected, but upon exiting, it raises the following exception:

hello world

Exception ignored in: <function KernelClient.__del__ at 0x7f706835dea0>
Traceback (most recent call last):
  File "/home/vivek/zeza/AIDEN_experiment/sandbox/jupyter_client/jupyter_client/client.py", line 121, in __del__
  File "/home/vivek/miniconda3/envs/test/lib/python3.10/site-packages/traitlets/traitlets.py", line 687, in __get__
  File "/home/vivek/miniconda3/envs/test/lib/python3.10/site-packages/traitlets/traitlets.py", line 666, in get
TypeError: 'NoneType' object is not callable

Environment
Python version: 3.10.14
Operating System: Ubuntu 22.04
jupyter_client version: 8.6.2

@mwohlf
Copy link

mwohlf commented Jul 5, 2024

same issue here

@trentmaetzold
Copy link

Getting this while running km, kc = jupyter_client.manager.start_new_kernel().

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

3 participants