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!
Your question is too broad: some deprecation warnings are printed when executing .sage scripts. For example:
P = Permutations(4); x = P([3,4,2,1]); x.has_left_descent(2, mult='l2r')
. The question is, why isn't this one printing? I don't actually see it when I run plain Python, although it seems to be a plain Python deprecation warning.Hello, @John Palmieri! Yes, my question is very broad because I require a very broad approach: I need my Sage and LaTeX commands/environments to catch every single warning issued by Sage or Python, when executing a .sage script.
Specifically, my Sage/LaTeX commands/environments create a global .sage file for a .tex document with the extracted code, much like sageTeX does. Then I need to execute that script, and I need it to print every single warning message issued in the process.
The objective of these commands and environments is to keep the embedded code up-to-date and clean. So, deprecation warnings (or any other kind of warning) being ignored is not a point in favor.