[BUG] bpytop unable to run on System missing "/sys/class/power_supply"
See original GitHub issueDescribe the bug
bpytop can’t be used on a CentOS8 System because of the following error “Data collection thread failed with exception: [Errno 2] No such file or directory: ‘/sys/class/power_supply’”.
This makes sense because a VM does not have a Power Supply but this should not stop bpytop from running on a System. If i can provide any more information id be happy to do so.
To Reproduce
Install bpytop on CentOS8 inside a openvz/lxc VM and try to run it.
Expected behaviour
bpytop should start and run as usual inside a virtual environment, minus the not displayable information
Screenshots
Not needed? bpytop just crashes on startup.
Info (please complete the following information):
- bpytop version: 1.0.50
- psutil version: 5.7.3
- (Linux) Linux distribution and version: CentOS 8 (Linux h2865053.stratoserver.net 4.18.0 #1 SMP Tue Jun 9 12:58:54 MSK 2020 x86_64 x86_64 x86_64 GNU/Linux)
- Terminal used: /dev/pts/0
- Font used: terminus-font (default from CentOS8?)
- Python version, Python 3.6.8
Additional context
contents of ~/.config/bpytop/error.log
04/12/20 (21:38:10) | ERROR: Data collection thread failed with exception: [Errno 2] No such file or directory: '/sys/class/power_supply' Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/bpytop.py", line 2600, in _runner collector._draw() File "/usr/local/lib/python3.6/site-packages/bpytop.py", line 2873, in _draw CpuBox._draw_fg() File "/usr/local/lib/python3.6/site-packages/bpytop.py", line 1714, in _draw_fg if CONFIG.show_battery and cls.battery_activity(): File "/usr/local/lib/python3.6/site-packages/bpytop.py", line 1643, in battery_activity if not hasattr(psutil, "sensors_battery") or psutil.sensors_battery() == None: File "/usr/local/lib64/python3.6/site-packages/psutil/__init__.py", line 2270, in sensors_battery return _psplatform.sensors_battery() File "/usr/local/lib64/python3.6/site-packages/psutil/_pslinux.py", line 1339, in sensors_battery bats = [x for x in os.listdir(POWER_SUPPLY_PATH) if x.startswith('BAT') or FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/power_supply' 04/12/20 (21:38:10) | WARNING: Exiting with errorcode (1). Runtime 0:00:02
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@paedeveloper My bad. Need to fix that too 😃 Here is a sample full config with
show_battery
set to false:Should work better.
@LifeLifeLP Fixed (regardless of show_battery setting) in 1.0.51