question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] bpytop unable to run on System missing "/sys/class/power_supply"

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
aristocratoscommented, Dec 13, 2020

@paedeveloper My bad. Need to fix that too 😃 Here is a sample full config with show_battery set to false:

#? Config file for bpytop v. 1.0.50

#* Color theme, looks for a .theme file in "/usr/[local/]share/bpytop/themes" and "~/.config/bpytop/themes", "Default" for builtin default theme.
#* Prefix name by a plus sign (+) for a theme located in user themes folder, i.e. color_theme="+monokai"
color_theme="Default"

#* If the theme set background should be shown, set to False if you want terminal background transparency
theme_background=False

#* Set bpytop view mode, "full" for everything shown, "proc" for cpu stats and processes, "stat" for cpu, mem, disks and net stats shown.
view_mode=full

#* Update time in milliseconds, increases automatically if set below internal loops processing time, recommended 2000 ms or above for better sample times for graphs.
update_ms=2000

#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu responsive",
#* "cpu lazy" updates top process over time, "cpu responsive" updates top process directly.
proc_sorting="cpu lazy"

#* Reverse sorting order, True or False.
proc_reversed=False

#* Show processes as a tree
proc_tree=False

#* Which depth the tree view should auto collapse processes at
tree_depth=3

#* Use the cpu graph colors in the process list.
proc_colors=True

#* Use a darkening gradient in the process list.
proc_gradient=True

#* If process cpu usage should be of the core it's running on or usage of the total available cpu power.
proc_per_core=False

#* Show process memory as bytes instead of percent
proc_mem_bytes=True

#* Check cpu temperature, needs "osx-cpu-temp" on MacOS X.
check_temp=True

#* Which sensor to use for cpu temperature, use options menu to select from list of available sensors.
cpu_sensor=Auto

#* Show temperatures for cpu cores also if check_temp is True and sensors has been found
show_coretemp=True

#* Draw a clock at top of screen, formatting according to strftime, empty string to disable.
draw_clock="%X"

#* Update main ui in background when menus are showing, set this to false if the menus is flickering too much for comfort.
background_update=True

#* Custom cpu model name, empty string to disable.
custom_cpu_name=""

#* Optional filter for shown disks, should be last folder in path of a mountpoint, "root" replaces "/", separate multiple values with comma.
#* Begin line with "exclude=" to change to exclude filter, oterwise defaults to "most include" filter. Example: disks_filter="exclude=boot, home"
disks_filter=""

#* Show graphs instead of meters for memory values.
mem_graphs=True

#* If swap memory should be shown in memory box.
show_swap=True

#* Show swap as a disk, ignores show_swap value above, inserts itself after first disk.
swap_disk=True

#* If mem box should be split to also show disks info.
show_disks=True

#* Set fixed values for network graphs, default "10M" = 10 Mibibytes, possible units "K", "M", "G", append with "bit" for bits instead of bytes, i.e "100mbit"
net_download="100Mbit"
net_upload="100Mbit"

#* Start in network graphs auto rescaling mode, ignores any values set above and rescales down to 10 Kibibytes at the lowest.
net_auto=True

#* Sync the scaling for download and upload to whichever currently has the highest scale
net_sync=True

#* If the network graphs color gradient should scale to bandwith usage or auto scale, bandwith usage is based on "net_download" and "net_upload" values
net_color_fixed=False

#* Show battery stats in top right if battery is present
show_battery=False

#* Show init screen at startup, the init screen is purely cosmetical
show_init=False

#* Enable check for new version from github.com/aristocratos/bpytop at start.
update_check=True

#* Set loglevel for "~/.config/bpytop/error.log" levels are: "ERROR" "WARNING" "INFO" "DEBUG".
#* The level set includes all lower levels, i.e. "DEBUG" will show all logging info.
log_level=DEBUG

Should work better.

0reactions
aristocratoscommented, Dec 19, 2020

@LifeLifeLP Fixed (regardless of show_battery setting) in 1.0.51

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Install and Use BpyTop Resource Monitoring Tool in ...
Bpytop is a terminal-based resource monitor that shows various device resources in an effective and visually appealing manner. It has a game- ...
Read more >
bpytop - Awesome Linux, macOS and FreeBSD resource ...
The bpytop is an awesome resource monitor (disk, network, process, CPU) Linux, macOS, FreeBSD, and Unix-like system written in Python 3.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found