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 '\.' #370

Closed
jrom99 opened this issue Jul 17, 2024 · 2 comments · Fixed by #371
Closed

SyntaxWarning: invalid escape sequence '\.' #370

jrom99 opened this issue Jul 17, 2024 · 2 comments · Fixed by #371

Comments

@jrom99
Copy link

jrom99 commented Jul 17, 2024

This line raises the following warning for python3.12:

pypandoc/pandoc_download.py:61: SyntaxWarning: invalid escape sequence '\.'

The line in question:

regex = re.compile(r"/jgm/pandoc/releases/download/.*(?:"+processor_architecture+"|x86|mac).*\\.(?:msi|deb|pkg)")

This could be solved by turning the second string into a raw string:

 regex = re.compile(r"/jgm/pandoc/releases/download/.*(?:"+processor_architecture+r"|x86|mac).*\.(?:msi|deb|pkg)") 

or just using using a raw f-string:

 regex = re.compile(fr"/jgm/pandoc/releases/download/.*(?:{processor_architecture}|x86|mac).*\.(?:msi|deb|pkg)") 
@lesinigo
Copy link

We get it under python3.11 too but only under CI (pytest in alpine3.19 with python3.11) and I've not yet been able to reproduce it locally. The resulting container build with the same source code under the same python3.11 in the same alpine3.19 seems unaffected.

@JessicaTegner
Copy link
Owner

I'll be able to get to it in a little while, otherwise, someone is welcome to open a quick pr for it.
SIdenote: raw f strings seems cool, didn't know they were a thing, especially not a thing so far back, compatibility wise.

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.

3 participants