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

[BUG] RHEL-10(python-3.12) prints many "SyntaxWarning: invalid escape sequence" messages #3157

Open
yuxisun1217 opened this issue Jul 9, 2024 · 1 comment
Assignees

Comments

@yuxisun1217
Copy link

Describe the bug: A clear and concise description of what the bug is.
In RHEL-10(python-3.12), enable AutoUpdate, after VM boot up, we can see such logs in waagent.log:

2024-07-09T06:15:06.048592Z INFO ExtHandler ExtHandler Logs from the waagent-network-setup.service since system boot:
 Jul 09 06:14:56 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/agent.py:331: SyntaxWarning: invalid escape sequence '\w'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/agent.py:331: SyntaxWarning: invalid escape sequence '\w'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:65: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:66: SyntaxWarning: invalid escape sequence '\w'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:108: SyntaxWarning: invalid escape sequence '\-'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:111: SyntaxWarning: invalid escape sequence '\-'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:116: SyntaxWarning: invalid escape sequence '\-'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:225: SyntaxWarning: invalid escape sequence '\.'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:231: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:65: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:66: SyntaxWarning: invalid escape sequence '\w'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:108: SyntaxWarning: invalid escape sequence '\-'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:111: SyntaxWarning: invalid escape sequence '\-'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:116: SyntaxWarning: invalid escape sequence '\-'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:225: SyntaxWarning: invalid escape sequence '\.'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/version.py:231: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/utils/flexible_version.py:198: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/utils/flexible_version.py:198: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/default.py:61: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/default.py:109: SyntaxWarning: invalid escape sequence '\s'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/default.py:126: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/default.py:61: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/default.py:109: SyntaxWarning: invalid escape sequence '\s'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/default.py:126: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/freebsd.py:554: SyntaxWarning: invalid escape sequence '\('
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/freebsd.py:565: SyntaxWarning: invalid escape sequence '\('
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/freebsd.py:554: SyntaxWarning: invalid escape sequence '\('
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/freebsd.py:565: SyntaxWarning: invalid escape sequence '\('
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/openwrt.py:34: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:57 wala10gpu07090226-vm1 python3[777]: /var/lib/waagent/WALinuxAgent-2.11.1.4/bin/WALinuxAgent-2.11.1.4-py3.9.egg/azurelinuxagent/common/osutil/openwrt.py:34: SyntaxWarning: invalid escape sequence '\d'
Jul 09 06:14:58 wala10gpu07090226-vm1 python3[777]: Setting up firewall for the WALinux Agent with args: {'dst_ip': '168.63.129.16', 'uid': '0', 'wait': '-w'}
Jul 09 06:14:58 wala10gpu07090226-vm1 python3[777]: Successfully set the firewall rules
Jul 09 06:14:58 wala10gpu07090226-vm1 systemd[1]: Finished waagent-network-setup.service - Setup network rules for WALinuxAgent.

Distro and WALinuxAgent details (please complete the following information):

  • Distro and Version: RHEL-10
  • WALinuxAgent version
# waagent -version
WALinuxAgent-2.9.1.1 running on rhel 10.0
Python: 3.12.2
Goal state agent: 2.11.1.4

Additional context

  • If set AutoUpdate=n, then reboot VM, cannot see such logs.
  • After the above step, if set AutoUpdate=y and "systemctl restart waagent", then "journalctl -u waagent-network-setup.service -b --utc" doesn't print such logs. Then run "systemctl restart waagent-network-setup.service" and then "journalctl -u waagent-network-setup.service -b --utc", can print these logs.
@yuxisun1217
Copy link
Author

It seems a known issue about python3.12 (https://docs.python.org/3/whatsnew/3.12.html#other-language-changes).
The second change like this:

A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.)

@narrieta narrieta self-assigned this Jul 16, 2024
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

2 participants