Azure / Azure/WALinuxAgent

[BUG] Python 3.8.13 Platform module does not have supported_dists attribute

Open
#2,589 4 comments 1 reaction 1 assignee Claimed by @nagworld9 View on GitHub
triaged
Dominant language
Python
Stars
581
Forks
397
Avg merge
2d 15h
Merged PRs (30d)
9

Description

**Describe the bug: A clear and concise description of what the bug is.**
walinuxagent.service (2.2.45) can't run with Python 3.8.13

Note: Please add some context which would help us understand the problem better
1. Section of the log where the error occurs.
2. Serial console output
```
/usr/sbin/waagent:27: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/future.py", line 43, in get_linux_distribution
supported = platform._supported_dists + (supported_dists,)
AttributeError: module 'platform' has no attribute '_supported_dists'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/sbin/waagent", line 31, in
import azurelinuxagent.agent as agent
File "/usr/lib/python3/dist-packages/azurelinuxagent/agent.py", line 34, in
import azurelinuxagent.common.event as event
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/event.py", line 34, in
from azurelinuxagent.common.version import CURRENT_VERSION, CURRENT_AGENT
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/version.py", line 144, in
__distro__ = get_distro()
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/version.py", line 84, in get_distro
osinfo = get_linux_distribution(0, 'alpine')
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/future.py", line 61, in get_linux_distribution
return get_linux_distribution_from_distro(get_full_name)
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/future.py", line 72, in get_linux_distribution_from_distro
distro.linux_distribution(
NameError: name 'distro' is not defined
```
4. Steps to reproduce the behavior.
- Install Ubuntu LTS (18.04.1) from Azure and upgrade Python version from 3.6 to 3.8.13

**Distro and WALinuxAgent details (please complete the following information):**
- Distro and Version: Ubuntu 18.04.1
- WALinuxAgent version 2.2.45

**Additional context**
Add any other context about the problem here.

**Log file attached**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.