[modules/battery] Ignore errors when reading status

Reading status - similar to reading the capacity - might fail, just
ignore that error.

see #221
This commit is contained in:
Tobias Witek 2018-01-11 19:30:37 +01:00
parent 82db0a14c1
commit bbfb6fc095

View file

@ -107,6 +107,8 @@ class Module(bumblebee.engine.Module):
charge = ""
with open("{}/status".format(widget.name)) as f:
charge = f.read().strip()
except IOError:
pass
if charge == "Discharging":
state.append("discharging-{}".format(min([10, 25, 50, 80, 100], key=lambda i: abs(i-capacity))))
else: