Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxWarning: invalid escape sequence #655

Open
ryandesign opened this issue Apr 1, 2024 · 0 comments
Open

SyntaxWarning: invalid escape sequence #655

ryandesign opened this issue Apr 1, 2024 · 0 comments

Comments

@ryandesign
Copy link

ryandesign commented Apr 1, 2024

If scons uses python 3.12 or later, these warnings appear:

scons: Reading SConscript files ...
SConstruct:839: SyntaxWarning: invalid escape sequence '\.'
  'sed -i "s/2\.0\.0/{v}/g" po/rmlint.pot',
SConstruct:840: SyntaxWarning: invalid escape sequence '\('
  'sed -i "s/^Version:\(\s*\)2\.0\.0/Version:\\1{v}/g" pkg/fedora/rmlint.spec'

See https://docs.python.org/3/library/re.html:

The solution is to use Python’s raw string notation for regular expression patterns; backslashes are not handled in any special way in a string literal prefixed with 'r'. So r"\n" is a two-character string containing '\' and 'n', while "\n" is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw string notation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant