Open ftpronk opened 6 years ago
I ran into the same issue. It means that any exception that occurs from code that the user typed in crashes the kernel.
I know that InProcessKernel
is pretty much deprecated, but as of now, there is no (well documented) alternative. Is this something that might get fixed by the devs, or is this the final death sentence for InProcessKernel
?
The problem seems to be that the io_loop attribute (along with the msg_queue attribute) are normally set by the kernel base class in ipykernel.kernelbase.Kernel.start()
. Normally the kernel base class start method would be called when the kernel was started, but the InProcessKernel start method of ipykernel.inprocess.ipkernel.InProcessKernel
seems to not call the baseclass start()
method in order to "override registration of dispatchers for streams".
In my application, kernel.control_stream is None and there are no entries in kernel.shell_streams so the stream dispatchers wouldn't be registered anyway.
My workaround is to call the base class method directly on condition that the io_loop attribute is missing after starting the in process kernel:
kernel.start()
if not hasattr(kernel,"io_loop"):
import ipykernel.kernelbase
ipykernel.kernelbase.Kernel.start(kernel)
Suggested permanent fix:
Either add the io_loop and msg_queue initialization to the InProcessKernel.start()
method or have that method call the superclass if the need to not register dispatchers is obsolete
I filed a similar bug under the
jupyter/qtconsole
project, but later narrowed the problem down toipykernel
, so I'm opening a new bug report here.I was working with an IPython qtconsole embedded in some C++ code, which used to work. But after a recent update, I cannot exit the console/quit my app using exit/exit()/quit/quit().
The problem seems to have been introduced in
ipykernel==4.7
, downgrading toipykernel==4.6.1
solves the problem. Here's a minimal test example:The error returned is the following:
The output of
python -c "import IPython; print(IPython.sys_info())"
on my machine is:The pip versions of the (relevant) packages on my system are:
And I'm using the system package for PySide, version 1.2.2