diff --git a/glances/plugins/glances_sensors.py b/glances/plugins/glances_sensors.py index 22b1dfab..1c841a60 100644 --- a/glances/plugins/glances_sensors.py +++ b/glances/plugins/glances_sensors.py @@ -19,7 +19,7 @@ """Sensors plugin.""" -from psutil import sensors_temperatures +import psutil from glances.logger import logger from glances.compat import iteritems @@ -219,13 +219,14 @@ class Plugin(GlancesPlugin): class GlancesGrabSensors(object): - """Get sensors stats using the py3sensors library.""" + """Get sensors stats.""" def __init__(self): """Init sensors stats.""" try: - sensors_temperatures() - except Exception: + # XXX: psutil>=5.1.0 is required + self.stemps = psutil.sensors_temperatures() + except AttributeError: self.initok = False else: self.initok = True @@ -246,7 +247,7 @@ class GlancesGrabSensors(object): return self.sensors_list # Temperature sensor - for chipname, chip in iteritems(sensors_temperatures()): + for chipname, chip in iteritems(self.stemps): i = 1 for feature in chip: sensors_current = {} diff --git a/optional-requirements.txt b/optional-requirements.txt index 869343a7..d7555fe4 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -21,4 +21,3 @@ scandir; python_version < "3.5" statsd wifi zeroconf -https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.zip diff --git a/tox.ini b/tox.ini index 8506e5ee..3c54c1d2 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,6 @@ deps = psutil bottle batinfo - https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.tar.gz commands = python unitest.py python unitest-restful.py