aws-cloudformation/cloudformation-cli

Syntax warnings on Python 3.12

siennathesane opened this issue · 2 comments

When running cfn on Python 3.12, it throws this syntax error:

$ cfn --version
/opt/homebrew/Cellar/cloudformation-cli/0.2.38/libexec/lib/python3.12/site-packages/rpdk/core/contract/hook_client.py:451: SyntaxWarning: invalid escape sequence '\s'
  regex = "__CFN_HOOK_START_RESPONSE__([\s\S]*)__CFN_HOOK_END_RESPONSE__"  # noqa: W605,B950 # pylint: disable=C0301
/opt/homebrew/Cellar/cloudformation-cli/0.2.38/libexec/lib/python3.12/site-packages/rpdk/core/contract/resource_client.py:738: SyntaxWarning: invalid escape sequence '\s'
  regex = "__CFN_RESOURCE_START_RESPONSE__([\s\S]*)__CFN_RESOURCE_END_RESPONSE__"  # noqa: W605,B950 # pylint: disable=C0301
cfn 0.2.38

How did you install Python, and how are you running cfn-cli?

If cfn-cli or Python was installed via brew, I noticed this occurring with many of my tools that used the brew python as the base environment after an update to Python. I use pipx and reinstalled all tools with a 3.12 runtime created by pyenv.

I had to reinstall python from scratch to resolve the issues I was facing for the tools that do not work well within pipx.

I installed it with pip install cloudformation-cli using my homebrew python