Python warning in lyx2lyx
José Matos
jaomatos at gmail.com
Mon Mar 3 10:08:37 UTC 2025
On Sat, 2025-03-01 at 21:49 +0100, Jean-Marc Lasgouttes wrote:
> /home/jean-marc/src/lyx/master/lib/lyx2lyx/lyx_2_5.py:2464:
> SyntaxWarning: invalid escape sequence '\e'
> cmd = " special=\"" + scmd + "r@{\extracolsep{0pt}" + decpoint + "}"
> + scmd2 + "l\">"
>
> I cannot reproduce it for some reason.
The issue above is the "r@{\extracolsep{0pt}" string.
By default all backslashes mark an escape sequence.
In the above we have "\e" as a part of the string, that escape sequence is
unknown. Python keeps the sequence in the string but warns that the escape
sequence is unknown.
One solution is, just like Jürgen did, to escape the backslash itself:
"r@{\\extracolsep{0pt}"
The other option is to change the string to be raw, by prefixing an r before the
string starts, where backslashes are normal characters:
r"r@{\extracolsep{0pt}"
If there is more backslash the second option is better (IMHO). If there is just
one backslash I choose one of the options and do not think back. :-)
Best regards,
--
José Abílio
More information about the lyx-devel
mailing list