Python warning: lyx_pot.py:607: SyntaxWarning: invalid escape sequence '\w'

Scott Kostyshak skostysh at lyx.org
Sat Jun 8 04:15:59 UTC 2024


I see several warnings on a newer system (with Python 3.12.3) along the
following lines:

[  7%] /usr/bin/python3 /home/scott/lyxbuilds/master-master/repo/po/lyx_pot.py -b /home/scott/lyxbuilds/master-master/repo -o  /home/scott/lyxbuilds/master-master/CMakeBuild/po/examples_templates_l10n.pot -t examples_templates --src_file=/home/scott/lyxbuilds/master-master/CMakeBuild/po/examples_templates_files
cd /home/scott/lyxbuilds/master-master/CMakeBuild/po && /usr/bin/python3 /home/scott/lyxbuilds/master-master/repo/po/lyx_pot.py -b /home/scott/lyxbuilds/master-master/repo -o /home/scott/lyxbuilds/master-master/CMakeBuild/po/examples_templates_l10n.pot -t examples_templates --src_file=/home/scott/lyxbuilds/master-master/CMakeBuild/po/examples_templates_files
/home/scott/lyxbuilds/master-master/repo/po/lyx_pot.py:607: SyntaxWarning: invalid escape sequence '\w'
  reg = re.compile('Encoding [\w-]+\s+[\w-]+\s+"([\w \-\(\)\[\]\/^"]*)"\s+["\w-]+\s+(fixed|variable|variableunsafe)\s+\w+.*')

In the attached patch, I just put a 'r' in front of the string inside
re.compile(). It seems to make Python happy. Is it OK to commit?

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-python-warning.diff
Type: text/x-diff
Size: 801 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240608/f2109dc2/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240608/f2109dc2/attachment.asc>


More information about the lyx-devel mailing list