nvidia_temp: use post_config_hook
@@ -30,9 +30,9 @@ SAMPLE OUTPUT
import re
TEMP_RE = re.compile(r"Current Temp\s+:\s+([0-9]+)")
-STRING_NOT_INSTALLED = "nvidia-smi: isn't installed"
-STRING_UNAVAILABLE = "nvidia_temp: N/A"
STRING_ERROR = "nvidia_temp: unknown error"
+STRING_NOT_INSTALLED = 'not installed'
+STRING_UNAVAILABLE = "nvidia_temp: N/A"
class Py3status:
@@ -60,14 +60,11 @@ class Py3status:
],
}
- def nvidia_temp(self):
+ def post_config_hook(self):
if not self.py3.check_commands('nvidia-smi'):
- return {
- 'cached_until': self.py3.CACHE_FOREVER,
- 'color': self.py3.COLOR_BAD,
- 'full_text': STRING_NOT_INSTALLED
- }
+ raise Exception(STRING_NOT_INSTALLED)
+ def nvidia_temp(self):
try:
temps = self.py3.command_output('nvidia-smi -q -d TEMPERATURE')
except:
