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.Sat, 11 Aug 2018 08:03:53 +0200NameError: name 'Integer' is not definedhttps://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/ Hi,
all of a sudden, I'm experiencing a strange error and cannot find any solution for it.
Sage itself works fine, but as soon as I try to load any .sage file, the application can't start. Inside sage I can do any calculation/operation as usual, but if I for example load an application that contains:
a=1
b=2
sage returns:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-496f9e9073df> in <module>()
----> 1 load("u.sage")
sage/structure/sage_object.pyx in sage.structure.sage_object.load (/build/sagemath/src/sage-7.4/src/src/build/cythonized/sage/structure/sage_object.c:12333)()
/usr/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
245 if attach:
246 add_attached_file(fpath)
--> 247 exec(preparse_file(open(fpath).read()) + "\n", globals)
248 elif ext == '.spyx' or ext == '.pyx':
249 if attach:
/usr/lib/python2.7/site-packages/sage/structure/sage_object.so in <module>()
NameError: name 'Integer' is not defined
Yesterday everything was working fine. I hadn't done any system upgrades and the error appears on programs written and working yesterday and on new written programs.
Does anyone know how to solve this error or where it suddenly comes from? A restart didn't change anything...Thu, 10 Nov 2016 15:25:50 +0100https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/Comment by kcrisman for <p>Hi,
all of a sudden, I'm experiencing a strange error and cannot find any solution for it.
Sage itself works fine, but as soon as I try to load any .sage file, the application can't start. Inside sage I can do any calculation/operation as usual, but if I for example load an application that contains:</p>
<pre><code>a=1
b=2
</code></pre>
<p>sage returns:</p>
<pre><code>---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-496f9e9073df> in <module>()
----> 1 load("u.sage")
sage/structure/sage_object.pyx in sage.structure.sage_object.load (/build/sagemath/src/sage-7.4/src/src/build/cythonized/sage/structure/sage_object.c:12333)()
/usr/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
245 if attach:
246 add_attached_file(fpath)
--> 247 exec(preparse_file(open(fpath).read()) + "\n", globals)
248 elif ext == '.spyx' or ext == '.pyx':
249 if attach:
/usr/lib/python2.7/site-packages/sage/structure/sage_object.so in <module>()
NameError: name 'Integer' is not defined
</code></pre>
<p>Yesterday everything was working fine. I hadn't done any system upgrades and the error appears on programs written and working yesterday and on new written programs.</p>
<p>Does anyone know how to solve this error or where it suddenly comes from? A restart didn't change anything...</p>
https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=35507#post-id-35507For some reason sage.all isn't being imported. Can you tell us exactly what you are doing to load? Is this on your personal computer or in the cloud or ... ? Tell us as much detail about your specific situation as you can.Thu, 10 Nov 2016 16:16:25 +0100https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=35507#post-id-35507Comment by kcrisman for <p>Hi,
all of a sudden, I'm experiencing a strange error and cannot find any solution for it.
Sage itself works fine, but as soon as I try to load any .sage file, the application can't start. Inside sage I can do any calculation/operation as usual, but if I for example load an application that contains:</p>
<pre><code>a=1
b=2
</code></pre>
<p>sage returns:</p>
<pre><code>---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-496f9e9073df> in <module>()
----> 1 load("u.sage")
sage/structure/sage_object.pyx in sage.structure.sage_object.load (/build/sagemath/src/sage-7.4/src/src/build/cythonized/sage/structure/sage_object.c:12333)()
/usr/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
245 if attach:
246 add_attached_file(fpath)
--> 247 exec(preparse_file(open(fpath).read()) + "\n", globals)
248 elif ext == '.spyx' or ext == '.pyx':
249 if attach:
/usr/lib/python2.7/site-packages/sage/structure/sage_object.so in <module>()
NameError: name 'Integer' is not defined
</code></pre>
<p>Yesterday everything was working fine. I hadn't done any system upgrades and the error appears on programs written and working yesterday and on new written programs.</p>
<p>Does anyone know how to solve this error or where it suddenly comes from? A restart didn't change anything...</p>
https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=35508#post-id-35508Similar but due to an incompatibility in processors, maybe: https://ask.sagemath.org/question/32330/sage-notebook-is-not-working/Thu, 10 Nov 2016 16:17:45 +0100https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=35508#post-id-35508Comment by 0x22 for <p>Hi,
all of a sudden, I'm experiencing a strange error and cannot find any solution for it.
Sage itself works fine, but as soon as I try to load any .sage file, the application can't start. Inside sage I can do any calculation/operation as usual, but if I for example load an application that contains:</p>
<pre><code>a=1
b=2
</code></pre>
<p>sage returns:</p>
<pre><code>---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-496f9e9073df> in <module>()
----> 1 load("u.sage")
sage/structure/sage_object.pyx in sage.structure.sage_object.load (/build/sagemath/src/sage-7.4/src/src/build/cythonized/sage/structure/sage_object.c:12333)()
/usr/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
245 if attach:
246 add_attached_file(fpath)
--> 247 exec(preparse_file(open(fpath).read()) + "\n", globals)
248 elif ext == '.spyx' or ext == '.pyx':
249 if attach:
/usr/lib/python2.7/site-packages/sage/structure/sage_object.so in <module>()
NameError: name 'Integer' is not defined
</code></pre>
<p>Yesterday everything was working fine. I hadn't done any system upgrades and the error appears on programs written and working yesterday and on new written programs.</p>
<p>Does anyone know how to solve this error or where it suddenly comes from? A restart didn't change anything...</p>
https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=35657#post-id-35657This is happening when I am in the sage terminal (local, not in the cloud) and I type load("file.sage").
The machine is running arch-linux. I'm not using notebook or anything else. Just the simple sage console. Everything else works fine. When I - instead of loading the file inside sage - type in my bash sage file.sage, sage creates a .py file and works fine too. There seems to be an error retrieving the file inside sage and I don't know why.
EDIT: I'm using a AMD A10-5750M APU.Sat, 19 Nov 2016 15:49:58 +0100https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=35657#post-id-35657Comment by ortollj for <p>Hi,
all of a sudden, I'm experiencing a strange error and cannot find any solution for it.
Sage itself works fine, but as soon as I try to load any .sage file, the application can't start. Inside sage I can do any calculation/operation as usual, but if I for example load an application that contains:</p>
<pre><code>a=1
b=2
</code></pre>
<p>sage returns:</p>
<pre><code>---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-496f9e9073df> in <module>()
----> 1 load("u.sage")
sage/structure/sage_object.pyx in sage.structure.sage_object.load (/build/sagemath/src/sage-7.4/src/src/build/cythonized/sage/structure/sage_object.c:12333)()
/usr/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
245 if attach:
246 add_attached_file(fpath)
--> 247 exec(preparse_file(open(fpath).read()) + "\n", globals)
248 elif ext == '.spyx' or ext == '.pyx':
249 if attach:
/usr/lib/python2.7/site-packages/sage/structure/sage_object.so in <module>()
NameError: name 'Integer' is not defined
</code></pre>
<p>Yesterday everything was working fine. I hadn't done any system upgrades and the error appears on programs written and working yesterday and on new written programs.</p>
<p>Does anyone know how to solve this error or where it suddenly comes from? A restart didn't change anything...</p>
https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=43102#post-id-43102Hi
**on cocalc.com (Jupyter notebook) I do not understand why I got the error:**
<ipython-input-2-73242bf2b10b> in __init__(self, diceT, diceColorT)
57 freqT = np.array(self.diceT[die])
58 # array multiplication term by term with numpy with SageMath Integer format setting
---> 59 valueT = [Integer(a) for a in np.bincount(freqT)]
60 nonZeroValueT=[Integer(a) for a in np.nonzero(valueT)[0]]
61
NameError: global name 'Integer' is not defined
**and the same code is error free on my local sage 8.2 W10 notebook.
do I have to import a library ?**Sun, 22 Jul 2018 14:46:25 +0200https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=43102#post-id-43102Comment by kcrisman for <p>Hi,
all of a sudden, I'm experiencing a strange error and cannot find any solution for it.
Sage itself works fine, but as soon as I try to load any .sage file, the application can't start. Inside sage I can do any calculation/operation as usual, but if I for example load an application that contains:</p>
<pre><code>a=1
b=2
</code></pre>
<p>sage returns:</p>
<pre><code>---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-496f9e9073df> in <module>()
----> 1 load("u.sage")
sage/structure/sage_object.pyx in sage.structure.sage_object.load (/build/sagemath/src/sage-7.4/src/src/build/cythonized/sage/structure/sage_object.c:12333)()
/usr/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
245 if attach:
246 add_attached_file(fpath)
--> 247 exec(preparse_file(open(fpath).read()) + "\n", globals)
248 elif ext == '.spyx' or ext == '.pyx':
249 if attach:
/usr/lib/python2.7/site-packages/sage/structure/sage_object.so in <module>()
NameError: name 'Integer' is not defined
</code></pre>
<p>Yesterday everything was working fine. I hadn't done any system upgrades and the error appears on programs written and working yesterday and on new written programs.</p>
<p>Does anyone know how to solve this error or where it suddenly comes from? A restart didn't change anything...</p>
https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=35509#post-id-35509Also possibly related: https://groups.google.com/forum/#!topic/sage-support/XvMtTF5Oes0Thu, 10 Nov 2016 16:18:24 +0100https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=35509#post-id-35509Answer by ortollj for <p>Hi,
all of a sudden, I'm experiencing a strange error and cannot find any solution for it.
Sage itself works fine, but as soon as I try to load any .sage file, the application can't start. Inside sage I can do any calculation/operation as usual, but if I for example load an application that contains:</p>
<pre><code>a=1
b=2
</code></pre>
<p>sage returns:</p>
<pre><code>---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-496f9e9073df> in <module>()
----> 1 load("u.sage")
sage/structure/sage_object.pyx in sage.structure.sage_object.load (/build/sagemath/src/sage-7.4/src/src/build/cythonized/sage/structure/sage_object.c:12333)()
/usr/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
245 if attach:
246 add_attached_file(fpath)
--> 247 exec(preparse_file(open(fpath).read()) + "\n", globals)
248 elif ext == '.spyx' or ext == '.pyx':
249 if attach:
/usr/lib/python2.7/site-packages/sage/structure/sage_object.so in <module>()
NameError: name 'Integer' is not defined
</code></pre>
<p>Yesterday everything was working fine. I hadn't done any system upgrades and the error appears on programs written and working yesterday and on new written programs.</p>
<p>Does anyone know how to solve this error or where it suddenly comes from? A restart didn't change anything...</p>
https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?answer=43103#post-id-43103for my case on cocalc.com site I need to add import sage.all.
and each time I use a specific SageMath function I need to add sage.all. in front of Integer()
also for show, and Arrangement(), no error since I add this sage.all. every time I use a sage function . ;-)
it is the link given by kcrisman which help me, the first one : https://ask.sagemath.org/question/323...
(edited , I made an error on the good link )
I put below a link on my cocalc code:
edited: the link was wrong . now it is ok.
[non-TransitiveDice cocalc public code](https://share.cocalc.com/share/24af7826-75ca-477a-82a4-09f106b6ab15/Non-TransitiveDice2018-07-22/2018-07-22-080937.ipynb)Sun, 22 Jul 2018 15:26:26 +0200https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?answer=43103#post-id-43103Answer by nbruin for <p>Hi,
all of a sudden, I'm experiencing a strange error and cannot find any solution for it.
Sage itself works fine, but as soon as I try to load any .sage file, the application can't start. Inside sage I can do any calculation/operation as usual, but if I for example load an application that contains:</p>
<pre><code>a=1
b=2
</code></pre>
<p>sage returns:</p>
<pre><code>---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-496f9e9073df> in <module>()
----> 1 load("u.sage")
sage/structure/sage_object.pyx in sage.structure.sage_object.load (/build/sagemath/src/sage-7.4/src/src/build/cythonized/sage/structure/sage_object.c:12333)()
/usr/lib/python2.7/site-packages/sage/repl/load.pyc in load(filename, globals, attach)
245 if attach:
246 add_attached_file(fpath)
--> 247 exec(preparse_file(open(fpath).read()) + "\n", globals)
248 elif ext == '.spyx' or ext == '.pyx':
249 if attach:
/usr/lib/python2.7/site-packages/sage/structure/sage_object.so in <module>()
NameError: name 'Integer' is not defined
</code></pre>
<p>Yesterday everything was working fine. I hadn't done any system upgrades and the error appears on programs written and working yesterday and on new written programs.</p>
<p>Does anyone know how to solve this error or where it suddenly comes from? A restart didn't change anything...</p>
https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?answer=43256#post-id-43256You can avoid having to prefix functions with `sage.all.` all the time by using `from sage.all import *`. That should put all the standard sage bindings in your namespace, so that you can use `Integer` etc. as usual. This is essentially what the sage shell does to make the default sage bindings available.Sat, 04 Aug 2018 22:17:04 +0200https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?answer=43256#post-id-43256Comment by ortollj for <p>You can avoid having to prefix functions with <code>sage.all.</code> all the time by using <code>from sage.all import *</code>. That should put all the standard sage bindings in your namespace, so that you can use <code>Integer</code> etc. as usual. This is essentially what the sage shell does to make the default sage bindings available.</p>
https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=43326#post-id-43326Thanks nbruinSat, 11 Aug 2018 08:03:53 +0200https://ask.sagemath.org/question/35506/nameerror-name-integer-is-not-defined/?comment=43326#post-id-43326