notebook and init.sage
I recently upgraded from 5.9 to 5.12.
My init.sage file loads/attaches a .sage file that I often use. In 5.9, that file was still attached when I started up a worksheet in the notebook. In 5.12, it is attached in the terminal, but when I then start open a worksheet in the notebook, it seems to be no longer attached since none of my functions are known any more and give a NameError when tried.
What can I do to fix this?
What is the exact syntax you used? This has recently changed (though I thought it was before 5.9) and conceivably affected things.
It looks to me as though this broke between Sage 5.10 (where it works) and 5.11 (where it doesn't). I think the problem was introduced in http://trac.sagemath.org/ticket/14523.
This bug has now been reported at http://trac.sagemath.org/ticket/15308.
I have a problem that may be related. I use load_attach_path followed by attach. I get the error "NameError: name 'var' is not defined" from within the attached file. I am using Ubuntu 12.04 x64 and using the Sage notebook. This worked in 5.10 and stopped working in 5.11.
I've also reported this upstream at https://github.com/sagemath/sagenb/issues/251
There is a pull request to fix this (though not to fix attach) at https://github.com/sagemath/sagenb/pu...
Also, @BobB, it would be really interesting to hear how you are able to use
attach
properly in the notebook if you useload_attach_path
. Maybe that is how attach got broken in the first place in the notebook, improper use of a path. (There are really two "attach" lists there - the one for Sage and the one for the data directory, unfortunately.)As far as "properly" is concerned, I'm not sure I ever did use it properly. I just wanted to reuse sage code and the load_attach_path/attach seemed to work just fine. I never tried or used the capability of sage to keep track of changes to attached files and re-execute, as it seems it should be able to do. Using load_attach_path/load works (tried at your suggestion, thank you) so I'm fine. I was using attach in the first place because I did not know better.