ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 30 Dec 2014 08:30:27 +0100notebook and init.sagehttps://ask.sagemath.org/question/10610/notebook-and-initsage/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?
Mon, 14 Oct 2013 22:05:37 +0200https://ask.sagemath.org/question/10610/notebook-and-initsage/Comment by kcrisman for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25173#post-id-25173@BobB - is the reason you used `load_attach_path` because of https://github.com/sagemath/sagenb/issues/107 ? Thanks!Mon, 08 Dec 2014 20:44:37 +0100https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25173#post-id-25173Comment by kcrisman for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16928#post-id-16928What is the exact syntax you used? This has recently changed (though I thought it was before 5.9) and conceivably affected things.Mon, 14 Oct 2013 22:53:47 +0200https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16928#post-id-16928Comment by kcrisman for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=24622#post-id-24622I've also reported this upstream at https://github.com/sagemath/sagenb/issues/251Fri, 24 Oct 2014 15:03:19 +0200https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=24622#post-id-24622Comment by kcrisman for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25100#post-id-25100There is a pull request to fix this (though not to fix attach) at https://github.com/sagemath/sagenb/pull/267Wed, 03 Dec 2014 20:32:16 +0100https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25100#post-id-25100Comment by kcrisman for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25101#post-id-25101Also, @BobB, it would be really interesting to hear how you are able to use `attach` properly in the notebook if you use `load_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.)Wed, 03 Dec 2014 20:33:15 +0100https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25101#post-id-25101Comment by John Palmieri for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16912#post-id-16912It 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.Sat, 19 Oct 2013 19:27:14 +0200https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16912#post-id-16912Comment by BobB for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16910#post-id-16910I 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.Sun, 20 Oct 2013 00:12:16 +0200https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16910#post-id-16910Comment by BobB for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25365#post-id-25365I'm really sorry about the large delays in my replies.
First, I used load_attach_path because I thought it was necessary for attach to know where to find files. I did not start using it because of the cited issue.
So, I have a cell and it contains:
load_attach_path('/home/sage/Documents/SageProjects/OrthogonalCoordinates')
attach('CartesianCoord.sage')
CartesianCoord.sage is in the directory named in the load_attach_path, and it contains:
var('q_1,q_2,q_3,x_1,x_2,x_3')
and evaluation results in an error message I will post in another comment, because there isn't enough space left in this comment.Tue, 30 Dec 2014 08:29:55 +0100https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25365#post-id-25365Comment by BobB for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25366#post-id-25366Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_5.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("bG9hZF9hdHRhY2hfcGF0aCgnL2hvbWUvc2FnZS9Eb2N1bWVudHMvU2FnZVByb2plY3RzL09ydGhvZ29uYWxDb29yZGluYXRlcycpCmF0dGFjaCgnQ2FydGVzaWFuQ29vcmQuc2FnZScp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmpNZTIvb/___code___.py", line 3, in <module>
exec compile(u"attach('CartesianCoord.sage')" + '\n', '', 'single')
File "", line 1, in <module>
File "sage/misc/lazy_import.pyx", line 358, in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3230)
File "/home/sage/sage-6.4.1/local/lib/python2.7/site-packages/sage/misc/attached_files.py", line 344, in attach
load(filename, globals(), attach=True)
File "/home/sage/sage-6.4.1/local/lib/python2.7/site-packages/sage/misc/preparser.py", line 1792, in load
exec(code, globals)
File "/home/sage/.sage/temp/ubuntu/3303/CartesianCoord.sageaIwXL1.py", line 5, in <module>
var('q_1,q_2,q_3,x_1,x_2,x_3')
NameError: name 'var' is not definedTue, 30 Dec 2014 08:30:27 +0100https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25366#post-id-25366Comment by kcrisman for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25171#post-id-25171@BobB : what I meant is that knowing the *exact* sequence of commands you used could be vital to fixing the problem! If this other solution does allow you to attach a file, probably examining the difference in code will allow us to diagnose (and fix) the other problem. Thank you very much if you have it! If I am misinterpreting and now `attach` continues to not work then this is just another manifestation of https://github.com/sagemath/sagenb/issues/169 . Thanks!Mon, 08 Dec 2014 15:36:58 +0100https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25171#post-id-25171Comment by BobB for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25156#post-id-25156As 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.Sun, 07 Dec 2014 09:28:26 +0100https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=25156#post-id-25156Comment by John Palmieri for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16911#post-id-16911This bug has now been reported at http://trac.sagemath.org/ticket/15308.Sat, 19 Oct 2013 19:29:41 +0200https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16911#post-id-16911Answer by AndreWin for <p>I recently upgraded from 5.9 to 5.12.</p>
<p>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.</p>
<p>What can I do to fix this?</p>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?answer=15562#post-id-15562Hello!
The problem is in file <pre>$SAGE_ROOT/spkg/bin/sage-env</pre><br>
There is line SAGE_STATUP_FILE = "$DOT_SAGE/init.sage"<br>
I replaced this line to:<br>
SAGE_STATUP_FILE = "home/andrei/.sage/init.sage"<br>
I found the bug in such way:<br>
>>import os
>>os.environ['SAGE_STARTUP_FILE']
/home/andrei/.sage//init.sageSat, 19 Oct 2013 15:31:13 +0200https://ask.sagemath.org/question/10610/notebook-and-initsage/?answer=15562#post-id-15562Comment by John Palmieri for <p>Hello!
The problem is in file </p><pre>$SAGE_ROOT/spkg/bin/sage-env</pre><br/>
There is line SAGE_STATUP_FILE = "$DOT_SAGE/init.sage"<br/>
I replaced this line to:<br/>
SAGE_STATUP_FILE = "home/andrei/.sage/init.sage"<br/>
I found the bug in such way:<br/><p></p>
<pre><code>>>import os
>>os.environ['SAGE_STARTUP_FILE']
/home/andrei/.sage//init.sage
</code></pre>
https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16913#post-id-16913First, what OS are you using? Second, what is the bug here? (Having multiple slashes in a row doesn't actually affect the path: `/home/andrei/.sage/init.sage` and `/home/andrei/.sage//init.sage` point to the same file.) Third, making your change doesn't seem to have any effect: the file will still be loaded from the command-line, and not from the notebook.Sat, 19 Oct 2013 19:04:31 +0200https://ask.sagemath.org/question/10610/notebook-and-initsage/?comment=16913#post-id-16913