diff options
author | PMR <pmr@pmr-lander> | 2019-11-25 09:15:46 +0000 |
---|---|---|
committer | PMR <pmr@pmr-lander> | 2019-11-25 09:15:46 +0000 |
commit | 2a28bc0290217186ca76b7d7c010b3ef8975217a (patch) | |
tree | ff404aca81064c03a50521f861ee6f9377baf681 | |
parent | b3f1eb36ed6d9a855cbeede4e8e75fd8ecea5768 (diff) | |
parent | 42b3074e0ee763f06f821a36385053f26124481d (diff) |
Merge #375944 from ~kissiel/plainbox-provider-checkbox:fix-1849652-fan-reaction-crash
-rwxr-xr-x | bin/fan_reaction_test.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/fan_reaction_test.py b/bin/fan_reaction_test.py index 3ae6362..a4ab744 100755 --- a/bin/fan_reaction_test.py +++ b/bin/fan_reaction_test.py @@ -37,9 +37,12 @@ class FanMonitor: def get_rpm(self): result = {} for p in self._fan_paths: - with open(p, 'rt') as f: - fan_mon_name = os.path.relpath(p, '/sys/class/hwmon') - result[fan_mon_name] = int(f.read()) + try: + with open(p, 'rt') as f: + fan_mon_name = os.path.relpath(p, '/sys/class/hwmon') + result[fan_mon_name] = int(f.read()) + except OSError: + print('Fan SysFS node dissappeared ({})'.format(p)) return result def get_average_rpm(self, period): acc = self.get_rpm() |