-
-
Notifications
You must be signed in to change notification settings - Fork 398
Description
In the current version (6.4.1), the enable_gui function of the InProcessInteractiveShell calls the same function in 'eventloops.py', which then sets kernel.eventloop to one of the loop functions, depending on the requested GUI, whereas it is normally set to None. Subsequent commands typed in the shell trigger a call to the parent kernel class enter_eventloop function, which causes an exception because attributes like io_loop and msg_queue are not defined by the InProcessKernel.
It is not clear to me that there is any reason for enable_gui to call the 'eventloops.py' version, since the In Process event loop will already have been initialized. This is, I believe, a convenience function for third-party applications to make sure the event loop has been started, and so unnecessary for the InProcessKernel. For example, importing 'pyplot' has the unfortunate effect of trying to enable an event loop unnecessarily, causing the exception mentioned above. I believe that the fix is to make the enable_gui function essentially a dummy function, i.e.,
def enable_gui(self, gui=None):
"""Enable GUI integration for the kernel."""
if not gui:
gui = self.kernel.gui
self.active_eventloop = gui
This may be one of the reasons for #319, which is still open, as well as some of the problems caused by #775. If people agree with this diagnosis, I can issue a PR.