Interrupting certain matplotlib operations leaves the inline backend 'wedged' #992

Closed
fperez opened this Issue Nov 11, 2011 · 5 comments

Comments

Projects
None yet
2 participants
@fperez
Member

fperez commented Nov 11, 2011

This is something I've only noticed on the notebook, though it likely also occurs with the qt console. If I interrupt a matplotlib rendering operation, quite often it becomes impossilbe to get any further plots to show up. Somewhere, we're holding state that isn't fully restored if the rendering operation is interrupted by the user.

Typing %pylab inline fixes it, but that's an arcane solution which also has the side-effect of re-importing all the pylab namespace on top of the user's interactive namespace.

I've had this bite me often enough lately to realize it will be a major usability headache for new users of the notebook, which is why I'm making it critical. I suspect it will be easy to fix once we have a look at our inline pylab code.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Nov 13, 2011

Member

It does indeed affect the qtconsole.

I presume this is my fault, from the changes in #892. I'll dig in.

Member

minrk commented Nov 13, 2011

It does indeed affect the qtconsole.

I presume this is my fault, from the changes in #892. I'll dig in.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Nov 13, 2011

Member

It turns out, this isn't in my changes at all, it's the fact that post-execute functions are unregistered on any exception (including KeyboardInterrupt). This is indeed easily fixed. There are two obvious options:

  1. never deactivate post-execute hooks on KeyboardInterrupt
  2. catch KeyboardInterrupt in flush_figures itself

I think 1. makes more sense, and is trivially fixed. I'll do a PR with this in a minute, adding some cleanup in the backend to make sure that the state is cleared, even if flush_figures() is interrupted.

Member

minrk commented Nov 13, 2011

It turns out, this isn't in my changes at all, it's the fact that post-execute functions are unregistered on any exception (including KeyboardInterrupt). This is indeed easily fixed. There are two obvious options:

  1. never deactivate post-execute hooks on KeyboardInterrupt
  2. catch KeyboardInterrupt in flush_figures itself

I think 1. makes more sense, and is trivially fixed. I'll do a PR with this in a minute, adding some cleanup in the backend to make sure that the state is cleared, even if flush_figures() is interrupted.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Nov 13, 2011

Member

PR #997 issued.

Member

minrk commented Nov 13, 2011

PR #997 issued.

@fperez

This comment has been minimized.

Show comment
Hide comment
@fperez

fperez Nov 20, 2011

Member

Closed by f3fe1c1, auto-close seems to be completely broken these days on github.

Member

fperez commented Nov 20, 2011

Closed by f3fe1c1, auto-close seems to be completely broken these days on github.

@fperez

This comment has been minimized.

Show comment
Hide comment
@fperez

fperez Nov 20, 2011

Member

oops, didn't click 'close'.

Member

fperez commented Nov 20, 2011

oops, didn't click 'close'.

@fperez fperez closed this Nov 20, 2011

stefanv pushed a commit to stefanv/ipython that referenced this issue Nov 30, 2011

don't unregister interrupted post-exec functions
only unregister on real Exceptions.

also put close/cleanup for the inline backend calls inside `finally` block,
to ensure that the state is clean on the next round, even if show/flush is interrupted

closes gh-992

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

don't unregister interrupted post-exec functions
only unregister on real Exceptions.

also put close/cleanup for the inline backend calls inside `finally` block,
to ensure that the state is clean on the next round, even if show/flush is interrupted

closes gh-992
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment