Skip to content

Silence Python invalid escape sequence warnings by turning some strings into raw strings #1

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

illwieckz
Copy link
Member

Silence such kind of warnings:

site_init:132: SyntaxWarning: invalid escape sequence '\$'
scons: Reading SConscript files ...
native_client/SConstruct:3626: SyntaxWarning: invalid escape sequence '\c'
  COVERAGE_ANALYZER='$COVERAGE_ANALYZER_DIR\coverage_analyzer.exe',
native_client/tools/command_tester.py:359: SyntaxWarning: invalid escape sequence '\*'
  match = re.match('\*\* (Signal|Mach exception) (\d+) from '
native_client/src/trusted/service_runtime/build.scons:827: SyntaxWarning: invalid escape sequence '\['
  RE_IDENT = '^\[[0-9,:.]*\] (e_ident\+1 = ELF)$'

It makes it easier to read error logs by not being confused by such warning noise.

@illwieckz illwieckz changed the title Silence Python unknown escape sequence warnings by turning some strings into raw strings Silence Python invalid escape sequence warnings by turning some strings into raw strings Apr 7, 2025
@@ -129,7 +129,7 @@ def BuildEnvironmentSConscripts(env):
else:
raise SCons.Errors.UserError(
'Bad location for a SConscript. "%s" is not under '
'\$TARGET_ROOT or \$MAIN_DIR' % c_script)
r'\$TARGET_ROOT or \$MAIN_DIR' % c_script)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe in this one, the backslashes are actually not wanted in the output and should be removed instead.

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

Successfully merging this pull request may close these issues.

2 participants