Sometimes when an exception occurs the prompt doesn't come back until you specifically press the ESC button.
What steps will reproduce the problem?
What is the expected output? What do you see instead?
I expect to immediately get the next input prompt but no prompt is shown until you press ESC.
Please provide any additional information below
In the GIF below the "hanging" behaviour is seen the last time I execute the incorrect code when the prompt isn't returned until I press ESC

This is on master

cython >=0.21 : 0.25.2 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
matplotlib >=1.0 : 2.0.2 (OK)
nbconvert >=4.0 : 5.1.1 (OK)
numpy >=1.7 : 1.12.1 (OK)
pandas >=0.13.1 : 0.20.1 (OK)
pycodestyle >=2.3: None (NOK)
pyflakes >=0.6.0 : 1.5.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.6.5 (OK)
qtconsole >=4.2.0: 4.3.0 (OK)
rope >=0.9.4 : 0.10.5 (OK)
sphinx >=0.6.6 : 1.6.1 (OK)
sympy >=0.7.3 : 1.0 (OK)
I see the same thing but I would not say that I don't get the prompt back. It is just that sometimes exceptions are written in the next input. In dhirschfeld's gif, the exception thrown in In[32] is displayed as text after In[33]. It should therefore be removed by either esc or removing the characters one by one. If I had to guess I would say that the prompt is coming back before the exception is displayed.
I tried to implement _handle_error in NamepaceBrowserWidget and it sometimes gets called after _handle_execute_reply, which causes this issue.
@impact27, thanks for looking into this. I don't exactly understand what we should do about it.
My guess is that this is a bug with ipykernel. I will try a workaround.