home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.62k stars 30.78k forks source link

Discogs platform 'SyntaxWarning: invalid escape sequence' since 2024.02 and Python 3.12 #116341

Closed ResteNarquois closed 6 months ago

ResteNarquois commented 6 months ago

The problem

Set up of Discogs platform creates warning in HA logs about 'invalid escape sequence'. This has been happening since 2024.02 and the move to Python 3.12. I've been slow to report as the function of the Collection and Random Record sensors seems otherwise unaffected (I don't use the Wantlist sensor).

I think it may be related to this change:

Reject invalid escape sequences (and octal escape sequences) in bytes and Unicode strings

The note here suggests it will eventually become an error rather than a warning.

What version of Home Assistant Core has the issue?

2024.02 and above

What was the last working version of Home Assistant Core?

2024.01

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Discogs

Link to integration documentation on our website

https://www.home-assistant.io/integrations/discogs/

Diagnostics information

No response

Example YAML snippet

- platform: discogs
  token: !secret discogs_token
  name: "Discogs Collection"
  monitored_conditions:
   - collection
   - random_record

Anything in the logs that might be useful for us?

Logger: py.warnings
Source: components/discogs/sensor.py:9
First occurred: 13:47:46 (1 occurrences)
Last logged: 13:47:46
/usr/local/lib/python3.12/site-packages/discogs_client/fetchers.py:102: SyntaxWarning: invalid escape sequence '\w' path_with_params = re.compile('(?P<dir>(\w+/)+)(?P<query>\w+)\?(?P<params>.*)')

Additional information

No response

home-assistant[bot] commented 6 months ago

Hey there @thibmaek, mind taking a look at this issue as it has been labeled with an integration (discogs) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `discogs` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign discogs` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


discogs documentation discogs source (message by IssueLinks)

ResteNarquois commented 6 months ago

Actually, digging a bit deeper, this seems to be an upstream issue in the discogs_client helper, and a PR has already been submitted there. I'll close this as not relevant to HA core.