qtconsole icon indicating copy to clipboard operation
qtconsole copied to clipboard

Cannot exit embedded console. AttributeError: 'InProcessKernel' object has no attribute 'io_loop'.

Open ftpronk opened this issue 6 years ago • 4 comments

System: Linux Mint 18.3 Xfce Edition. System: Kubuntu 16.04.

I was working with an IPython qtconsole embedded in some C++ code, which used to work. But after a recent update, I cannot exit console/quit my app using exit/exit()/quit/quit()

Looking for a minimal setup to make the bug reproducible, I noticed that I get the same error using the github inprocess example. I run it with python inprocess_qtconsole.py.

The error returned is the following:

In [1]: exit
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-e828459ebe2b> in <module>()
----> 1 exit()

/usr/local/lib/python2.7/dist-packages/IPython/core/autocall.pyc in __call__(self, keep_kernel)
     68     def __call__(self, keep_kernel=False):
     69         self._ip.keepkernel_on_exit = keep_kernel
---> 70         self._ip.ask_exit()

/usr/local/lib/python2.7/dist-packages/ipykernel/zmqshell.pyc in ask_exit(self)
    526     def ask_exit(self):
    527         """Engage the exit actions."""
--> 528         self.exit_now = (not self.keepkernel_on_exit)
    529         payload = dict(
    530             source='ask_exit',

/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.pyc in __set__(self, obj, value)
    583             raise TraitError('The "%s" trait is read-only.' % self.name)
    584         else:
--> 585             self.set(obj, value)
    586 
    587     def _validate(self, obj, value):

/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.pyc in set(self, obj, value)
    572             # we explicitly compare silent to True just in case the equality
    573             # comparison above returns something other than True/False
--> 574             obj._notify_trait(self.name, old_value, new_value)
    575 
    576     def __set__(self, obj, value):

/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.pyc in _notify_trait(self, name, old_value, new_value)
   1137             new=new_value,
   1138             owner=self,
-> 1139             type='change',
   1140         ))
   1141 

/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.pyc in notify_change(self, change)
   1174                 c = getattr(self, c.name)
   1175 
-> 1176             c(change)
   1177 
   1178     def _add_notifiers(self, handler, name, type):

/usr/local/lib/python2.7/dist-packages/ipykernel/zmqshell.pyc in _update_exit_now(self, change)
    470         """stop eventloop when exit_now fires"""
    471         if change['new']:
--> 472             loop = self.kernel.io_loop
    473             loop.call_later(0.1, loop.stop)
    474             if self.kernel.eventloop:

AttributeError: 'InProcessKernel' object has no attribute 'io_loop'

In [2]: 

The versions of the (relevant) packages on my system returned by pip:

ipykernel==4.8.2
ipython==5.5.0
ipython-genutils==0.2.0
ipywidgets==7.1.2
...
jupyter==1.0.0
jupyter-client==5.2.2
jupyter-console==5.2.0
jupyter-core==4.4.0
...
pyzmq==17.0.0
qtconsole==4.3.1

And I'm using the system package for PySide.

ftpronk avatar Mar 12 '18 21:03 ftpronk

Have you upgraded to tornado 5.0? That may be the issue. Try downgrading it to 4.x.

polwel avatar Mar 15 '18 13:03 polwel

I downgraded to tornado 4.5.3, but I got the same behaviour. I further downgraded to version 4.2, still with the same error. Tornado version 4.1 wouldn't run at all.

ftpronk avatar Mar 15 '18 14:03 ftpronk

Ok, never mind then. I came across a very similar issue, and reverting tornado helped. Sorry it did not work for you.

polwel avatar Mar 15 '18 15:03 polwel

Thank you for trying to help. :-)

ftpronk avatar Mar 16 '18 10:03 ftpronk