Running sage debug.py
does not resolve my issue. I was looking around in the ask.sagemath.org site and found this post : http://ask.sagemath.org/question/10173/run-python-file-from-command-line-in-sage/. Someone fixed similar issues adding this line to the beginning of the Python script: from sage.all import * So I tried and it fixed my problem ! I'm afraid I may be importing *way* too many things in my namespace but for now, it'll do the job. Anybody has hints on why this is required ? Does that has the effect of activating sage's virtual environment setup (kind of) ? Kind regards, Eric Le mercredi 28 janvier 2015 12:50:09 UTC-5, vdelecroix a écrit : > > Hello, > > If you want to run *pure* python you should use > > sage -python my_file.py > > By pure Python I mean which does not need any of the Sage stuff like > ZZ. If you want to run your file just do > > sage my_file.py > > Vincent > > 2015-01-28 18:43 UTC+01:00, Eric Parent <[email protected] <javascript:>>: > > > Hi, > > > > I'm running Debian Wheezy x86_64. > > I downloaded the sources (sage-6.4) which I compiled and run for a few > > months already. > > > > I used to run Python scripts from Sage like this: > > > > $ sage -python <script.py> > > > > The script was actually exported from a notebook I was running. I just > felt > > > > more comfortable running a script than going through the Notebook > > interface... > > > > And it worked just fine until this weekend. I guess my problems are due > to > > an update of my OS I did this weekend. I haven't kept note of the > various > > packages I updated. I think GCC was in the lot. > > > > Now, I can run the Notebook without any problem but I get this error > when I > > > > run my script : > > > > $ sage -python debug.py > > Traceback (most recent call last): > > File "debug.py", line 3, in <module> > > from sage.numerical.mip import MixedIntegerLinearProgram > > File > > > "/home/eric/apps/sage-6.4/local/lib/python2.7/site-packages/sage/numerical/__init__.py" > > > > , line 1, in <module> > > import all > > File > > > "/home/eric/apps/sage-6.4/local/lib/python2.7/site-packages/sage/numerical/all.py" > > > > , line 1, in <module> > > from optimize import (find_fit, > > File > > > "/home/eric/apps/sage-6.4/local/lib/python2.7/site-packages/sage/numerical/optimize.py" > > > > , line 14, in <module> > > from sage.modules.free_module_element import vector > > File "sage/rings/integer.pxd", line 9, in init > > sage.modules.free_module_element > > (build/cythonized/sage/modules/free_module_element.c:36437) > > File "sage/rings/rational.pxd", line 10, in init sage.rings.integer > > (build > > /cythonized/sage/rings/integer.c:41630) > > File "sage/rings/rational.pyx", line 56, in init sage.rings.rational ( > > build/cythonized/sage/rings/rational.c:30843) > > File > > > "/home/eric/apps/sage-6.4/local/lib/python2.7/site-packages/sage/rings/rational_field.py" > > > > , line 55, in <module> > > import infinity > > File > > > "/home/eric/apps/sage-6.4/local/lib/python2.7/site-packages/sage/rings/infinity.py" > > > > , line 213, in <module> > > from sage.rings.integer_ring import ZZ > > File "sage/rings/integer_ring.pyx", line 67, in init > > sage.rings.integer_ring > > (build/cythonized/sage/rings/integer_ring.c:11566) > > File > > > "/home/eric/apps/sage-6.4/local/lib/python2.7/site-packages/sage/structure/factorization.py" > > > > , line 188, in <module> > > from sage.misc.all import prod > > File > > > "/home/eric/apps/sage-6.4/local/lib/python2.7/site-packages/sage/misc/all.py" > > > , line 89, in <module> > > from functional import (additive_order, > > File > > > "/home/eric/apps/sage-6.4/local/lib/python2.7/site-packages/sage/misc/functional.py" > > > > , line 36, in <module> > > from sage.rings.complex_double import CDF > > File "sage/rings/real_double.pxd", line 8, in init > > sage.rings.complex_double > > (build/cythonized/sage/rings/complex_double.c:20095) > > File "sage/rings/real_double.pyx", line 56, in init > sage.rings.real_double > > > > (build/cythonized/sage/rings/real_double.c:22825) > > ImportError: cannot import name ZZ > > > > The problem concerns a simple import that now does not work. I just > putted > > these two lines in my "debug.py" script: > > > > from sage.numerical.mip import MixedIntegerLinearProgram > > print MixedIntegerLinearProgram.__doc__ > > > > I re-compiled my sources but the problem remains. Notebook still works > just > > > > fine. > > > > Any thoughts ? > > To be honest, I don't know the ZZ module. > > > > Any help would be appreciated. > > > > Kind regards, > > > > Eric > > > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "sage-support" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [email protected] <javascript:>. > > To post to this group, send email to [email protected] > <javascript:>. > > Visit this group at http://groups.google.com/group/sage-support. > > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
