ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 29 Mar 2018 12:43:15 -0500NameError: 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...0x22Thu, 10 Nov 2016 08:25:50 -0600https://ask.sagemath.org/question/35506/SageMath giving NameError on predefined functionshttps://ask.sagemath.org/question/41825/sagemath-giving-nameerror-on-predefined-functions/ I am following **Abstract Algebra an Interactive Approach** by *William Paulsen* but some of the functions in the first chapter itself, like `ShowTerry()`, `ItitTerry()`, `MultTable()` etc are giving `NameError`. Same is the case with most of the functions in the preliminaries chapter like `ShowRationals()`, `PowerMod()` <br/> I'm not really sure how to go about it. I even tried installing sage from Source Code but the problem persists. Do I have to install some separate group theory package or am I missing something here?JarwinThu, 29 Mar 2018 12:43:15 -0500https://ask.sagemath.org/question/41825/[RESOLVED]Use sage objects in python module fileshttps://ask.sagemath.org/question/36850/resolveduse-sage-objects-in-python-module-files/ Hello,
I'm trying to figure out how to use sage functions/classes in a module .py file, from another python file.
Here's the thing, I'm developing a small simulator in Python 2 intended to be use with sage for solving diff. equations, etc...
So I have different .py files (interface, calcul, etc) in which have been written some code using sage functions.
Let's say I have "y = var('y')" in calcul.py and I run it from sage console ->
sage: load("calcul.py")
sage:
All works properly without any failures.
But, if I want to import this module in interface.py and then run the file with sage, I get this error ->
sage: load("interface.py")
---> 1 y = var('y')
NameError: name 'var' is not defined
As if it didn't recognize its own functions.
Is there any command/function to use in sage to allow loading of imported files without that type of error ?
Thanks in advance for your help.
HyorvennTue, 07 Mar 2017 06:34:02 -0600https://ask.sagemath.org/question/36850/@fork decorator not recognized in scripthttps://ask.sagemath.org/question/10628/fork-decorator-not-recognized-in-script/I'm trying to run a test script with the @fork decorator, but it isn't being recognized. The script looks like this:
#!/home/raltman/sage-5.10/sage
@fork
def f(a):
return a;
out=f("hi");
print out;
When I run this, I get the following error message:
> Traceback (most recent call last):
> File "/home/raltman/test.sage", line
> 3, in <module>
>
>@fork
>
>NameError: name 'fork' is not defined
The same code works when I run it in the sage console, and the script itself works without the @fork decorator. I'd really appreciate any help on this!R AltmanFri, 18 Oct 2013 23:42:38 -0500https://ask.sagemath.org/question/10628/ImportError after (apparently peaceful) installationhttps://ask.sagemath.org/question/7747/importerror-after-apparently-peaceful-installation/Howdy all,
After install of 10.04 64bit ubuntu (with your help), upon first invocations sage reports: ImportError.
Here is the trace back:
__import__(modname)
import sage.all_cmdline
from sage.all import *
from sage.databases.all import *
from symbolic_data import SymbolicData
from xml.dom.minidom import parse
from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS
ImportError: cannot import name DOMImplementationLS. Error importing ipy_profile_sage - perhaps you should run %upgrade? WARNING: Loading of ipy_profile_sage failed.
<<well, yes, I followed the Sage advise and ran %upgrade, and got the same results. And, if I disregard all the error messages and proceed to something like:
sage: 3+4
NameError: name 'Integer' is not defined. >> Suggestions??Bill MSat, 30 Oct 2010 13:42:46 -0500https://ask.sagemath.org/question/7747/