From e40640d47d6e93592b85218b12e13824887abd2f Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Wed, 8 Feb 2017 12:42:02 +0100 Subject: [PATCH 1/2] psutil.sensors_temperatures() is available in version 5.1.0 or greater --- glances/plugins/glances_sensors.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 = {} From 06e12a21241946cd4ba8b6f472fe31bcfd42e8e1 Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Wed, 8 Feb 2017 13:01:07 +0100 Subject: [PATCH 2/2] Drop py3sensors from optional-requirements.txt and tox.ini too --- optional-requirements.txt | 1 - tox.ini | 1 - 2 files changed, 2 deletions(-) diff --git a/optional-requirements.txt b/optional-requirements.txt index 926c046a..ac97594d 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