After I installed SageMath-9.0 (MacApplication), I encountered the following warning in the log of SageTeX compilation.
Console
/Applications/SageMath-9.0.app/Contents/Resources/sage/local/lib/python3.7/site-packages/sagetex.py:63: DeprecationWarning: invalid escape sequence \S
[re.match(' *\S', line) for line in lines]
I looked through the internet and found a similar situation in some other software.
- ThiefMaster
- "invalid escape sequence" DeprecationWarnings with Python 3.6 #646
- github.com/pallets/jinja/issues/646
I am trying the solution of this page on GitHub.
The relevant part is around line 63 of sagetex.py
, which I quote here.
```python def strip_common_leading_spaces(s): lines = s.splitlines() lead = min(m.end() for m in [re.match(r' *\S', line) for line in lines] if m is not None) - 1 return '\n'.join(line[lead:] for line in lines) ```
As in this quotation, I just inserted the letter 'r' to the left of the string on line 63. It is the first line of the deepest indentation in this quotation.
Is this a good solution?