From 603fc1ddc6faecc49d47c76ee5837747b7ce14b5 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sun, 20 Oct 2019 14:28:45 +0200 Subject: [PATCH] [modules/battery_all] Add logging if no battery is found --- bumblebee/modules/battery_all.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/battery_all.py b/bumblebee/modules/battery_all.py index 52849bd..9882d7b 100644 --- a/bumblebee/modules/battery_all.py +++ b/bumblebee/modules/battery_all.py @@ -11,6 +11,7 @@ Parameters: import os import glob +import logging import bumblebee.input import bumblebee.output @@ -29,8 +30,8 @@ class Module(bumblebee.engine.Module): for battery in os.listdir('/sys/class/power_supply/'): if not any(i in battery for i in ['AC', 'hidpp']): self._batteries.append("/sys/class/power_supply/" + battery) - except: - pass + except as e: + logging.exception("unable to detect batteries: {}".format(str(e))) super(Module, self).__init__(engine, config, bumblebee.output.Widget(full_text=self.capacity))