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

Python 3.12 - SyntaxWarning: invalid escape sequence #188

Open
joshkersey opened this issue May 6, 2024 · 2 comments · May be fixed by #189
Open

Python 3.12 - SyntaxWarning: invalid escape sequence #188

joshkersey opened this issue May 6, 2024 · 2 comments · May be fixed by #189
Assignees

Comments

@joshkersey
Copy link

When running in Python 3.12 we see SyntaxWarning being raised for a couple regex strings:

/opt/venv/lib/python3.12/site-packages/docusign_esign/client/api_client.py:280: SyntaxWarning: invalid escape sequence '\['
  sub_kls = re.match('list\[(.*)\]', klass).group(1)
/opt/venv/lib/python3.12/site-packages/docusign_esign/client/api_client.py:285: SyntaxWarning: invalid escape sequence '\('
  sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)

It's my understanding this can be fixed either by either escaping the backslashes (re.match('list\\[(.*)\\]', klass).group(1)) or by using a raw string literal (re.match(r'list\[(.*)\]', klass).group(1).

@karankaushik95
Copy link

Hi @joshkersey Thanks for notifying us! Do you receive this when running something in particular or is this something you're able to reproduce all the time?

@Lucianod28 Lucianod28 linked a pull request May 11, 2024 that will close this issue
@Lucianod28
Copy link

Hi @joshkersey Thanks for notifying us! Do you receive this when running something in particular or is this something you're able to reproduce all the time?

This happens when the library is imported. It's documented here:

Changed in version 3.12: Unrecognized escape sequences produce a SyntaxWarning. In a future Python version they will be eventually a SyntaxError.

I fixed it in #189.

@garg-mudit garg-mudit self-assigned this May 17, 2024
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 a pull request may close this issue.

4 participants