4.0.4 - On Glances startup ERROR -- Can not init battery class ([WinError 3] even though sensors plugin disabled #2776

This commit is contained in:
Nicolas Hennion 2024-05-16 09:00:17 +00:00
parent 6acd0da704
commit d095e4ae34

View File

@ -13,18 +13,20 @@ import psutil
from glances.logger import logger
from glances.plugins.plugin.model import GlancesPluginModel
from glances.globals import LINUX
# Batinfo library (optional; Linux-only)
batinfo_tag = True
try:
import batinfo
except ImportError:
logger.debug("batinfo library not found. Fallback to psutil.")
if LINUX:
batinfo_tag = True
try:
import batinfo
except ImportError:
logger.debug("batinfo library not found. Fallback to psutil.")
batinfo_tag = False
else:
batinfo_tag = False
# Availability:
# Linux, Windows, FreeBSD (psutil>=5.1.0)
# macOS (psutil>=5.4.2)
# PsUtil Sensors_battery available on Linux, Windows, FreeBSD, macOS
psutil_tag = True
try:
psutil.sensors_battery()