Opened at 2025-01-13T20:40:35Z
Closed at 2025-01-16T22:05:03Z
#4158 closed defect (fixed)
SyntaxWarning: invalid escape sequence
| Reported by: | hacklschorsch | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | undecided |
| Component: | unknown | Version: | n/a |
| Keywords: | Cc: | ||
| Launchpad Bug: |
Description
I see a lot of "SyntaxWarning?: invalid escape sequence" warnings about us having things in strings that recent Python doesn't like.
For example, in the Debian 13 package CI runner, we find that *installing* the built package will emit lots of these warnings:
Selecting previously unselected package tahoe-lafs.
(Reading database ... 23602 files and directories currently installed.)
Preparing to unpack .../tahoe-lafs_1.20.0-1_all.deb ...
Unpacking tahoe-lafs (1.20.0-1) ...
Setting up tahoe-lafs (1.20.0-1) ...
/usr/lib/python3/dist-packages/allmydata/hashtree.py:73: SyntaxWarning: invalid escape sequence '\ '
"""
/usr/lib/python3/dist-packages/allmydata/hashtree.py:182: SyntaxWarning: invalid escape sequence '\ '
"""
/usr/lib/python3/dist-packages/allmydata/interfaces.py:409: SyntaxWarning: invalid escape sequence '\-'
"""This block of data contains integrity-checking information (hashes
/usr/lib/python3/dist-packages/allmydata/node.py:93: SyntaxWarning: invalid escape sequence '\.'
ADDR_RE = re.compile("^([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*)(:([1-9][0-9]*))?$")
/usr/lib/python3/dist-packages/allmydata/test/cli/test_backup.py:39: SyntaxWarning: invalid escape sequence '\d'
"(\d)+ files skipped, "
/usr/lib/python3/dist-packages/allmydata/test/cli/test_backup.py:40: SyntaxWarning: invalid escape sequence '\d'
"(\d+) directories created \((\d+) reused\), "
/usr/lib/python3/dist-packages/allmydata/test/cli/test_backup.py:41: SyntaxWarning: invalid escape sequence '\d'
"(\d+) directories skipped", out)
/usr/lib/python3/dist-packages/allmydata/test/cli/test_cli.py:767: SyntaxWarning: invalid escape sequence '\('
in_pending_msg_regex = "ran out of shares: complete= pending=Share\(.+\) overdue= unused= need 3"
/usr/lib/python3/dist-packages/allmydata/test/test_runner.py:257: SyntaxWarning: invalid escape sequence '\S'
self.failIf(re.search("[\S][^\.!?]$", line), (line,))
/usr/lib/python3/dist-packages/allmydata/test/web/test_web.py:1971: SyntaxWarning: invalid escape sequence '\s'
CSS_STYLE=re.compile(b'toolbar\s{.+text-align:\scenter.+toolbar-item.+display:\sinline',re.DOTALL)
/usr/lib/python3/dist-packages/allmydata/util/i2p_provider.py:192: SyntaxWarning: invalid escape sequence '\:'
escaped_sam_port = sam_port.replace(':', '\:')
/usr/lib/python3/dist-packages/allmydata/web/status.py:1559: SyntaxWarning: invalid escape sequence '\d'
u"_(\d\d)_(\d)_percentile",
/usr/lib/python3/dist-packages/allmydata/web/status.py:1560: SyntaxWarning: invalid escape sequence '\g'
u'{quantile="0.\g<1>\g<2>"}',
/usr/lib/python3/dist-packages/allmydata/hashtree.py:73: SyntaxWarning: invalid escape sequence '\ '
"""
/usr/lib/python3/dist-packages/allmydata/hashtree.py:182: SyntaxWarning: invalid escape sequence '\ '
"""
/usr/lib/python3/dist-packages/allmydata/interfaces.py:409: SyntaxWarning: invalid escape sequence '\-'
"""This block of data contains integrity-checking information (hashes
/usr/lib/python3/dist-packages/allmydata/node.py:93: SyntaxWarning: invalid escape sequence '\.'
ADDR_RE = re.compile("^([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*)(:([1-9][0-9]*))?$")
/usr/lib/python3/dist-packages/allmydata/test/cli/test_backup.py:39: SyntaxWarning: invalid escape sequence '\d'
"(\d)+ files skipped, "
/usr/lib/python3/dist-packages/allmydata/test/cli/test_backup.py:40: SyntaxWarning: invalid escape sequence '\d'
"(\d+) directories created \((\d+) reused\), "
/usr/lib/python3/dist-packages/allmydata/test/cli/test_backup.py:41: SyntaxWarning: invalid escape sequence '\d'
"(\d+) directories skipped", out)
/usr/lib/python3/dist-packages/allmydata/test/cli/test_cli.py:767: SyntaxWarning: invalid escape sequence '\('
in_pending_msg_regex = "ran out of shares: complete= pending=Share\(.+\) overdue= unused= need 3"
/usr/lib/python3/dist-packages/allmydata/test/test_runner.py:257: SyntaxWarning: invalid escape sequence '\S'
self.failIf(re.search("[\S][^\.!?]$", line), (line,))
/usr/lib/python3/dist-packages/allmydata/test/web/test_web.py:1971: SyntaxWarning: invalid escape sequence '\s'
CSS_STYLE=re.compile(b'toolbar\s{.+text-align:\scenter.+toolbar-item.+display:\sinline',re.DOTALL)
/usr/lib/python3/dist-packages/allmydata/util/i2p_provider.py:192: SyntaxWarning: invalid escape sequence '\:'
escaped_sam_port = sam_port.replace(':', '\:')
/usr/lib/python3/dist-packages/allmydata/web/status.py:1559: SyntaxWarning: invalid escape sequence '\d'
u"_(\d\d)_(\d)_percentile",
/usr/lib/python3/dist-packages/allmydata/web/status.py:1560: SyntaxWarning: invalid escape sequence '\g'
u'{quantile="0.\g<1>\g<2>"}',
Change History (3)
comment:1 Changed at 2025-01-13T21:22:23Z by hacklschorsch
comment:2 Changed at 2025-01-13T21:24:49Z by hacklschorsch
Maybe it's of interest that the list of warnings above are printed twice (Strg+F for "hashtree.py:73" for example)
comment:3 Changed at 2025-01-16T22:05:03Z by hacklschorsch
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.

Some context from https://stackoverflow.com/a/77531416/1181063