-
Notifications
You must be signed in to change notification settings - Fork 201
Description
Hello,
I'm new to Jupyter and qtconsole and I'm not even sure this is the right place to ask.
I'm writing a Qt-based application that uses a QtKernelManager and RichJupyterWidget.
The QtKernelManager uses a connection_file to connect to a running Jupyter kernel. I'm able to perform commands programmatically on the server like for example:
self.kernel_manager = QtKernelManager(connection_file=self.connection_file)
self.kernel_manager.load_connection_file()
self.kernel_client = self.kernel_manager.client()
self.kernel_client.start_channels()
# Execute command
self.kernel_client.execute("foo=27")
If I connect a qtconsole to the same kernel I can see the variable a value has changed which is what I expect.
However, in my application, I don't know how to retrieve the value of the variable foo (if, for example, it has been changed). Previously, I was using QtInProcessKernelManager, which exposed the methods .kernel.shell.push() and .kernel.shell.user_ns.get(). However, I have not been able to make QtInProcessKernelManager work with an external kernel. On the other hand, the QtKernelManager does not expose any similar methods, presumably because the kernel is running in a different process.
In short, is there a way to retrieve local variables with a QtKernelManager?
Thanks in advance.