[SciPy-User] Reset IPython to original blank state.

Robert Kern robert.kern@gmail....
Thu Nov 19 12:08:50 CST 2009

On Thu, Nov 19, 2009 at 10:53, Dharhas Pothina
<Dharhas.Pothina@twdb.state.tx.us> wrote:
> Hi All,
> I'm trying to do something like matlab's 'clear all; close all; fclose all;' this command basically resets matlab to a blank state by clearing all variables and closing all figures and files. It is hugely useful for avoiding old variables and data interfering with current work when interactively plotting and exploring data.
> With Ipython on Linux this is not too big of a deal since I can easily just quit and restart Ipython. On windows Ipython seems to take an inordinate amount of time to start so this is really an issue and causes the workflow to be interrupted.
> I've tried using %reset and while that seems to clear any variables in memory it doesn't seem to reset everything. I'm having lots of issues with matplotlib figures and other crashes related to 'too many open file handles' if I do not close and restart Ipython.

Where are these open files coming from? Most of the code in
numpy/matplotlib/IPython should be properly closing files. If it is
your code, it would be worth your time to fix your code to not keep
files open longer than necessary rather than restarting IPython.

> Any way around this. Is there a small script I could use to clear everything and take Ipython back to its original startup state without restarting it?

Not really, no.

Also, you will want to ask further IPython questions on the IPython
mailing list:


Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the SciPy-User mailing list