It's seems a fairly simple question but I didn't manage to correctly save my ipython session using magic "%save" If i use the magic "%paste" at any time during the session, saving the session results in this output :
get_ipython().magic(u'paste')
Of course, I would like the pasted code to be saved instead.
Any ideas?
I can reproduce this with version 3.1.0 of ipython on Ubuntu
But the help for
%save
states thatand that's actually what is happening. It is only saving the commands you type at the prompt, and the command you entered was
paste
, which the magic converts toget_ipython().magic(u'paste ')
.Interestingly, trying to
edit
the function I created withpaste
puts me invi
staring at the same magic command and not the pasted function.While the first behavior may not be a bug (even if it's not particularly helpful), this editing behavior definitely seems like one.
As kdopen's says, if you use
%save
If you want to record the input of
%paste
you could use%logstart
, during your session, you can stop and start logging with:%logoff
/%logon
Here is more info on how to use this command: logstart
When you want to restore your session remember to run ipython with:
-i yourlogfile.py
command line option. ie:ipython3 -i ipython_log.py