0

I recently discovered storemagic in ipython, and I would like to use it to save my work across sessions. However, in some sessions I generate a large number of variables, and I would like to say at the end of the session %store all, or something like that, so that I can easily %store -r and continue where I left off.

Is there any way I can do this? Note that I do not care much about the commands history and such, what I want is not to have to run the scripts over and over everytime ipython closes, freezes or crashes.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
  • The [dill](https://pypi.python.org/pypi/dill) package has a `save_session()` function which will try to save all the variables in your session. There isn't currently an option for this with %store. – Thomas K Mar 08 '15 at 00:25
  • Hi Thomas, thanks a lot for the tip, but unfortunately it doesn't really work. I manage to install dill according to the indications given in the documentation, but while it correctly imports and reads license information, it does not recognize the call save_session() (module has no attribute...). Also, i could not find that function anywhere in the documentation or in the .py files. Could it be that is not longer available? It also gives error if I call the dill.tests function, as indicated in the documentation. (I tried using pip and the tarball, both installations with the same outcome). –  Mar 09 '15 at 16:43
  • It appears to be called `dump_session()`, sorry. – Thomas K Mar 09 '15 at 22:09
  • Hi Thomas, thanks for the clarification, that one does exactly what I need. And thanks so much for your answers! –  Mar 10 '15 at 10:54

1 Answers1

2

Reposting as an answer:

The %store magic doesn't have an option to save the whole session, but the dill package has a function dump_session() which should do that.

Thomas K
  • 39,200
  • 7
  • 84
  • 86