fixed battery_percentage (#442)

This commit is contained in:
Tobias 2022-10-11 06:29:05 +02:00 committed by GitHub
parent e813301aa8
commit ff72e1e0f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -259,11 +259,11 @@ def battery_percentage():
"""
get batery percentage
"""
sensors_battery = psutil.sensors_battery()
if sensors_battery:
return round(sensors_battery.percent)
else:
return None
try:
percentage = psutil.sensors_battery().percent
except:
percentage = None
return percentage
def get_avail_gov():