mirror of
https://github.com/nicolargo/glances.git
synced 2024-08-16 16:00:27 +03:00
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:
parent
6acd0da704
commit
d095e4ae34
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user