DCL777/sensors2mqtt

Sensor LINUX_Generic_SystemInfo error

Closed this issue · 1 comments

Describe the bug
If you try to use Generic_SystemInfo sensor shows the same error:

AttributeError: module 'platform' has no attribute 'dist'

Error messages and traceback:

2022-07-19 20:15:01,799 - DEBUG -     --> CLASS: sensors.Generic_SystemInfo.LINUX_Generic_SystemInfo
Traceback (most recent call last):
  File "/home/pi/sensors2mqtt/sensors2mqtt.py", line 204, in <module>
    sens2mqtt.run()
  File "/home/pi/sensors2mqtt/sensors2mqtt.py", line 138, in run
    myClass = aClass(client,aSensor,mqtt_top_dir_name)
  File "/home/pi/sensors2mqtt/sensors/Generic_SystemInfo/LINUX_Generic_SystemInfo.py", line 51, in __init__
    dist = platform.dist()
AttributeError: module 'platform' has no attribute 'dist'

System:
Raspbian 11, Python 3.9.2

Possible workaround
Line 53 of file "sensors/Generic_SystemInfo/LINUX_Generic_SystemInfo.py"

import distro
dist = platform.dist()
to
dist = distro.like()

Thanks.
It's fixed
See HISTORY.md file for more info.
I used: distro.linux_distribution()