py3status: Battery module error
Describe the bug The bug seems to ocurr when my battery is fully charged and I’m using the acpi measurement mode (I’d wish to be able to use acpi measuring to get the time that the battery has) Your py3status version py3status version 3.49 (python 3.10.9) on sway
To Reproduce Steps to reproduce the behavior along with your py3status configuration (filter out any private values):
- Add module ‘battery_level’
- Configure module like the following:
battery_level {
blocks = ""
#battery_id = all
battery_id = 1
format = "{percent}% {icon}[\?if=time_remainin>
threshold_degraded = 20
hide_when_full = true
hide_seconds = true
notify_low_level = true
#measurement_mode = "sys"
measurement_mode = "acpi"
notification = true
}
- Wait until the battery is at 100% and the error sometimes pops up.
- See error.
Expected behavior The battery level to continue being hidden and no error to pop up.
Additional context
The error says battery_level: list index out of range, which I presume means some error with the acpi handling?
The logs say the following:
2023-03-25 10:26:23 WARNING Instance `battery_level`, user method `battery_level` failed.
2023-03-25 10:26:23 INFO Traceback
IndexError: list index out of range
File "/usr/lib/python3.10/site-packages/py3status/module.py", line 949, in run
response = method()
File "/usr/lib/python3.10/site-packages/py3status/modules/battery_level.py", line 198, in battery_level
battery_list = self.get_battery_info()
File "/usr/lib/python3.10/site-packages/py3status/modules/battery_level.py", line 290, in _extract_battery_info_from_acpi
return [_parse_battery_info(battery) for battery in acpi_list]
File "/usr/lib/python3.10/site-packages/py3status/modules/battery_level.py", line 290, in <listcomp>
return [_parse_battery_info(battery) for battery in acpi_list]
File "/usr/lib/python3.10/site-packages/py3status/modules/battery_level.py", line 262, in _parse_battery_info
findall(r"(?<= )(\d+)(?= mAh)", acpi_battery_lines[1])[1]
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 21 (9 by maintainers)
Most upvoted comments
+1
lasers on Apr 4, 2023