From 9818e8d750a91733efe9f7dfde47fd6c6cd318de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= Date: Mon, 20 Nov 2017 08:08:21 +0100 Subject: [PATCH] temp: Ignore pysensors exceptions on unavailable subfeature (#624) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- i3pystatus/temp.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/i3pystatus/temp.py b/i3pystatus/temp.py index 4d15e2c..16a2d34 100644 --- a/i3pystatus/temp.py +++ b/i3pystatus/temp.py @@ -42,12 +42,15 @@ def get_sensors(): for chip in sensors.get_detected_chips(): for feature in chip.get_features(): if feature.type == sensors.FEATURE_TEMP: - name = chip.get_label(feature) - max = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_MAX) - current = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_INPUT) - critical = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_CRIT) - if critical: - found_sensors.append(Sensor(name=name, current=current, maximum=max, critical=critical)) + try: + name = chip.get_label(feature) + max = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_MAX) + current = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_INPUT) + critical = get_subfeature_value(feature, sensors.SUBFEATURE_TEMP_CRIT) + if critical: + found_sensors.append(Sensor(name=name, current=current, maximum=max, critical=critical)) + except sensors.SensorsException: + continue return found_sensors