From 48e5074412e78619f81b83c1aa0ca496a437a719 Mon Sep 17 00:00:00 2001 From: Facetoe Date: Wed, 22 Nov 2017 19:21:48 +0800 Subject: [PATCH] temp.py: Raise an Exception if no sensors detected. (#627) Provides a better error message for cases such as #626. --- i3pystatus/temp.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/i3pystatus/temp.py b/i3pystatus/temp.py index e14c64e..b278461 100644 --- a/i3pystatus/temp.py +++ b/i3pystatus/temp.py @@ -203,6 +203,9 @@ class Temperature(IntervalModule, ColorRangeModule): """ data = dict() found_sensors = get_sensors() + if len(found_sensors) == 0: + raise Exception("No sensors detected! " + "Ensure lm-sensors is installed and check the output of the `sensors` command.") for sensor in found_sensors: data[sensor.name] = self.format_sensor(sensor) data["{}_bar".format(sensor.name)] = self.format_sensor_bar(sensor)