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

SyntaxWarnings "invalid escape sequence" in S3Uri.py and FileLists.py #1374

Open
TurtleWilly opened this issue Apr 13, 2024 · 1 comment
Open

Comments

@TurtleWilly
Copy link

I do encounter a heap of warnings (yes, I zipapp'ed s3cmd) which suggest proper bugs:

$ ./s3cmd.pyz --version
/Volumes/Temporary/s3cmd/./s3cmd.pyz/S3/S3Uri.py:122: SyntaxWarning: invalid escape sequence '\.'
/Volumes/Temporary/s3cmd/./s3cmd.pyz/S3/S3Uri.py:170: SyntaxWarning: invalid escape sequence '\w'
/Volumes/Temporary/s3cmd/./s3cmd.pyz/S3/S3Uri.py:122: SyntaxWarning: invalid escape sequence '\.'
/Volumes/Temporary/s3cmd/./s3cmd.pyz/S3/S3Uri.py:170: SyntaxWarning: invalid escape sequence '\w'
/Volumes/Temporary/s3cmd/./s3cmd.pyz/S3/FileLists.py:525: SyntaxWarning: invalid escape sequence '\*'
/Volumes/Temporary/s3cmd/./s3cmd.pyz/S3/FileLists.py:525: SyntaxWarning: invalid escape sequence '\*'
s3cmd version 2.4.0

The reported regex strings should be prefixed with "r" to become raw strings (like r".*\..*") or the backslashes need to be double escaped (like ".*\\..*"). I recommend the first option.

Note that a simple backslash triggers string escaping only (like "\n" or "\e", f.ex.), but what you are trying to achieve there is to escape characters from the regex (e.g. "." for a literal dot character and not "any character") or use special regex sequences (like "\w").

@TurtleWilly
Copy link
Author

I just found out that there is already a fix in the queue: #1370

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

No branches or pull requests

1 participant