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

fix: "invalid escape sequence" error in some regexp and strings. #8350

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

FomalhautWeisszwerg
Copy link

Fixed "invalid escape sequence" errors caused by missing 'r' modifiers or incomplete escaping in some strings.

Problem

Sometimes aws-cli stopped by errors like following

aws: error: argument --role-arn: expected one argument
/usr/local/lib/python3.12/site-packages/awscli/compat.py:463: SyntaxWarning: invalid escape sequence '\s'
  _distributor_id_file_re = re.compile("(?:DISTRIB_ID\s*=)\s*(.*)", re.I)
/usr/local/lib/python3.12/site-packages/awscli/compat.py:464: SyntaxWarning: invalid escape sequence '\s'
  _release_file_re = re.compile("(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I)
/usr/local/lib/python3.12/site-packages/awscli/compat.py:465: SyntaxWarning: invalid escape sequence '\s'
  _codename_file_re = re.compile("(?:DISTRIB_CODENAME\s*=)\s*(.*)", re.I)
/usr/local/lib/python3.12/site-packages/awscli/shorthand.py:132: SyntaxWarning: invalid escape sequence '\!'
  _START_WORD = u'\!\#-&\(-\+\--\<\>-Z\\\\-z\u007c-\uffff'
/usr/local/lib/python3.12/site-packages/awscli/shorthand.py:133: SyntaxWarning: invalid escape sequence '\s'
  _FIRST_FOLLOW_CHARS = u'\s\!\#-&\(-\+\--\\\\\^-\|~-\uffff'
/usr/local/lib/python3.12/site-packages/awscli/shorthand.py:134: SyntaxWarning: invalid escape sequence '\s'
  _SECOND_FOLLOW_CHARS = u'\s\!\#-&\(-\+\--\<\>-\uffff'
/usr/local/lib/python3.12/site-packages/awscli/customizations/cloudtrail/validation.py:76: SyntaxWarning: invalid escape sequence '\d'
  pattern = re.compile('arn:.+:cloudtrail:.+:\d{12}:trail/.+')
/usr/local/lib/python3.12/site-packages/awscli/customizations/codedeploy/push.py:65: SyntaxWarning: invalid escape sequence '\<'
  'uploading. Use the format s3://\<bucket\>/\<key\>'
/usr/local/lib/python3.12/site-packages/awscli/customizations/emr/createcluster.py:199: SyntaxWarning: invalid escape sequence '\d'
  is_valid_ami_version = re.match('\d?\..*', parsed_args.ami_version)
Unable to locate credentials. You can configure credentials by running "aws configure".

I saw the errors at aws-cli version 1.30.5 (commit 1a1e73c).

Cause of Errors

The errors caused by missing 'r' modifiers or incomplete escaping.

Description of changes

This pull request fixes missing 'r' modifiers and escaping in those strings.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Thanks for reviewing :-)

Fixed "invalid escape sequence" errors caused by missing 'r' modifiers
or incomplete escaping in some strings.
@begemotik
Copy link

Facing the same behavior

/app/.venv/lib/python3.12/site-packages/awscli/compat.py:463: SyntaxWarning: invalid escape sequence '\s'
  _distributor_id_file_re = re.compile("(?:DISTRIB_ID\s*=)\s*(.*)", re.I)
/app/.venv/lib/python3.12/site-packages/awscli/compat.py:464: SyntaxWarning: invalid escape sequence '\s'
  _release_file_re = re.compile("(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I)
...

Would appreciate reviewing it and merging

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

Successfully merging this pull request may close these issues.

None yet

2 participants