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.Wed, 01 Jul 2020 18:41:54 +0200Deprecation warning not showing for .sage scripthttps://ask.sagemath.org/question/52286/deprecation-warning-not-showing-for-sage-script/Hello, Sage Community!
With Sage 9.1, if I write `text('$\int$', (0,0))`, I get the following deprecation warning:
<input>:1: DeprecationWarning: invalid escape sequence \i
<input>:1: DeprecationWarning: invalid escape sequence \i
<input>:1: DeprecationWarning: invalid escape sequence \i
<ipython-input-2-75ff93257356>:1: DeprecationWarning: invalid escape sequence \i
text('$\int$', (Integer(0),Integer(0)))
Of course, the solution is to use raw strings: `text(r'$\int$', (0,0))`.
However, if I move that same command to a .sage script--let's call it `deprecation.sage`---, and I call `sage deprecation.sage`, I don't see any warning.
Previously, I had written a whole set of Sage and LaTeX commands for writing books and articles with Sage automatic calculations. These commands should check that the code is correct and no warning is issued by Sage. My problem here is that the commands do show every other types of warning, except for this one.
My question is: **Is there a way to activate deprecation warnings when executing .sage scripts?**
Thanks in advance for your answers!dsejasWed, 01 Jul 2020 18:41:54 +0200https://ask.sagemath.org/question/52286/Failing to add a script to sagehttps://ask.sagemath.org/question/49823/failing-to-add-a-script-to-sage/I have recently started using SageMath on MacOs (used to working in Magma) and my question has a high possibility of being dumb.. In any case, I am trying to run this code -- on github /catherineray/aut-jac and I am not able to even install it properly. Readme file specifies what I need (My magma has all the required specs etc) and, most likely, I am not able to set up SageTrac.
When I try to run autperio.sage it gives me this error
load('autperio.sage')
File "<string>", line 41
print Curve(f).genus()
^
SyntaxError: invalid syntaxGMAR77Thu, 06 Feb 2020 00:00:48 +0100https://ask.sagemath.org/question/49823/can't import sage into pythonhttps://ask.sagemath.org/question/48970/cant-import-sage-into-python/trying to write a python/sage script and in starting i am following the example
#!/usr/bin/env sage
import sys
from sage.all import *
if len(sys.argv) != 2:
print("Usage: %s <n>" % sys.argv[0])
print("Outputs the prime factorization of n.")
sys.exit(1)
print(factor(sage_eval(sys.argv[1])))
from [this sage docs link](https://doc.sagemath.org/html/en/tutorial/programming.html#standalone-python-sage-scripts) and i continue to get the variety of erros:
> ModuleNotFoundError: No module named 'sage.all'; 'sage' is not a package
> ImportError: No module named all
and variations thereof. sage runs from any directory just by typing sage and enter, so i dont believe its a path issue. ive also tried passing the -python argument to the shebang at the top of the script. i have tried to execute the script using:
> sage -python sage.py
> ./sage.py
i have also tried saving the file with a .sage extension and invoking the script also as above, all of and any combinations complain of the same inability to resolve the module importing of sage into the script. i know there are a number of similar questions on this site related to that error, but they most all seemed to also have problems invoking sage successfully from the cl with just typing sagealienfetuseaterSat, 07 Dec 2019 04:59:59 +0100https://ask.sagemath.org/question/48970/how to get hints on fixing silly syntax errorshttps://ask.sagemath.org/question/45243/how-to-get-hints-on-fixing-silly-syntax-errors/ Hi, I just spent half an hour on these two commands.
def mov():
P=matrix(QQ,[[1, 1],[0, 1]]);
show(P)
I retyped them, I moved them in different cells, nothing, I get syntax error.
"<ipython-input-76-049764d5c40b>", line 1
def mov() :
^
SyntaxError: invalid syntax
It works as long as I do not try to make a function
florinThu, 31 Jan 2019 12:05:30 +0100https://ask.sagemath.org/question/45243/How do I convert a notebook to a python script?https://ask.sagemath.org/question/8782/how-do-i-convert-a-notebook-to-a-python-script/I'm asking this because I'm starting a project and Sage seems like a very good platform to do some prototyping.
Better yet, it might be a great way to use the code that results from my prototyping directly has the final version as well.
But for that to work with a minimal of hardship though, a few things would be usefull:
1. A way to grab the code content of a notebook and generate an independent python script or function
2. A list of libraries, with version, that every sage version uses.
3. An instalable library version of sage that could be imported from the script
4. Anything else that I'm missing and you know sage can do to help in this task
I'm not asking for a completely automatic way to do this, just for resources/scripts or general advices about how to do it.
I'm also just starting to look into sage so, don't assume to much on what I may know. ;)
Thanks.Alexandre MartinsSat, 10 Mar 2012 14:58:00 +0100https://ask.sagemath.org/question/8782/Standalone Python/Sage Scriptshttps://ask.sagemath.org/question/33685/standalone-pythonsage-scripts/The tutorial example from
http://doc.sagemath.org/html/en/tutorial/programming.html#standalone-python-sage-scripts
is working only for integers. It does not work for symbolic expressions. It becomes working by renaming the script from "factor" to "factor.sage" and replacing the last line by
print factor(sage_eval(sys.argv[1],locals={'x':x}))
Is there anything wrong in my configuration of Sage?Klaus ScheicherTue, 07 Jun 2016 09:29:42 +0200https://ask.sagemath.org/question/33685/Run differents scripts in different cpu-coreshttps://ask.sagemath.org/question/10417/run-differents-scripts-in-different-cpu-cores/Hi experts!
Im a newby user of linux, python and sage.
I have a 4-core CPU (intel i3) and a 2-cores cpu in other laptop (intel atom N2600). I wanna run 6 different sage-scripts simultaneously ussing the 6 cores, i.e.: run one script for cpu-core.
I use Linux mint 13 in one laptop (2 cores-cpu) and Ubuntu 13.04 in the other laptop (4 cores).
How can i do that? (without using @parallel decotertor or other difficult stuff).
Waiting for your answers.
Thanks a lot!!mresimulatorMon, 05 Aug 2013 19:28:58 +0200https://ask.sagemath.org/question/10417/python/sage scriptshttps://ask.sagemath.org/question/9407/pythonsage-scripts/First of all, my apologies for being a noob and a windows user. I'm using sage in virtualbox. I'm at this part of the tutorial: sagenb.org/doc/live/tutorial/programming.html#standalone-python-sage-scripts
I'm having 2 problems:
(1) I can't execute "./factor 2006". It says "no such file or directory", but the file is definitely there, and "sage -python factor 2006" works.
(2) factoring polynomials doesn't seem to work for me in sage. If I call factor on a string I get a TypeError: "unable to factor n".
**Edit**: Part of the problem may have been that the script was in a shared folder in VirtualBox. Here is some exact input/output, working completely locally (this changes the error in (2)).
`>./factor 2006`
`/usr/bin/env: sage -python: No such file or directory`
`>sage -python factor "32*x^5-1"`
`NameError: name 'x' is not defined`
Any assistance is much appreciated!rmp251Tue, 09 Oct 2012 16:52:29 +0200https://ask.sagemath.org/question/9407/What does "./sage -cleaner" do?https://ask.sagemath.org/question/7595/what-does-sage-cleaner-do/What does "./sage -cleaner" do?
Does it just clean the build files in the currently selected branch? The usage output from "./sage -advanced" doesn't specify.ccanoncThu, 19 Aug 2010 16:04:54 +0200https://ask.sagemath.org/question/7595/