Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery_level: Prevent logic issues when zero #599

Merged
merged 1 commit into from Dec 23, 2016
Merged

Conversation

tobes
Copy link
Contributor

@tobes tobes commented Dec 21, 2016

When a value of zero was obtained we could end up with a value of None. This fixes the issue

TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'
  File "/home/toby/dev/py3status/py3status/module.py", line 584, in run
    response = method()
  File "/home/toby/dev/py3status/py3status/modules/battery_level.py", line 174, in battery_level
    self._refresh_battery_info()
  File "/home/toby/dev/py3status/py3status/modules/battery_level.py", line 316, in _refresh_battery_info
    battery_list = self._extract_battery_information_from_sys()
  File "/home/toby/dev/py3status/py3status/modules/battery_level.py", line 294, in _extract_battery_information_from_sys
    time_in_secs = (remaining_energy / present_rate * 3600)

@tobes tobes added the bug fix 🐛 I am fixing a bug label Dec 21, 2016
@ultrabug ultrabug merged commit 56da7ba into master Dec 23, 2016
@ultrabug
Copy link
Owner

Thanks mate !

@tobes tobes deleted the battery-level-fix branch December 23, 2016 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix 🐛 I am fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants