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

Fix SyntaxWarning in objects.py #651

Merged
merged 1 commit into from
Feb 23, 2024
Merged

Conversation

meator
Copy link
Contributor

@meator meator commented Feb 20, 2024

Hi. I'm trying to package auto-cpufreq to Void Linux. Void Linux byte compiles python packages. A common annoyance that is commonly seen when byte compiling is warnings about unknown escape sequences. This exact warning happens when installing auto-cpufreq:

./usr/lib/python3.12/site-packages/auto_cpufreq/gui/objects.py:35: SyntaxWarning: invalid escape sequence '\('
  return getoutput("echo \(Snap\) $SNAP_VERSION")
./usr/lib/python3.12/site-packages/auto_cpufreq/gui/objects.py:35: SyntaxWarning: invalid escape sequence '\('
  return getoutput("echo \(Snap\) $SNAP_VERSION")

(The warning got doubled for some reason. This is probably Void's fault, not auto-cpufreq's. But it makes it twice as annoying.)

I fix this issue in this PR by using a raw string literal.

\( and \) are invalid escape sequences in Python. This can generate warnings.
@shadeyg56
Copy link
Collaborator

shadeyg56 commented Feb 23, 2024

Great, thank you!
You'll be credited as part of the next release

@shadeyg56 shadeyg56 merged commit b4c5276 into AdnanHodzic:master Feb 23, 2024
@meator
Copy link
Contributor Author

meator commented Feb 23, 2024

Well, I have contributed a single character to the repo so far. I don't really expect any recognition for that. But thanks!

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 this pull request may close these issues.

None yet

2 participants