From a2517fa06096f5b8f627bd86899361ab6bd4d20d 2014-05-12 00:52:29 From: Dav Clark Date: 2014-05-12 00:52:29 Subject: [PATCH] Close graphics dev in finally clause\ncloses #4408 (already closed) --- diff --git a/IPython/extensions/rmagic.py b/IPython/extensions/rmagic.py index a590fe7..b20939f 100644 --- a/IPython/extensions/rmagic.py +++ b/IPython/extensions/rmagic.py @@ -624,8 +624,8 @@ class RMagics(Magics): print(e.err) rmtree(tmpd) return - - self.r('dev.off()') + finally: + self.r('dev.off()') # read out all the saved .png files