From 05636a6568e984a0aa01efa5b6402f5872b70fb0 Mon Sep 17 00:00:00 2001 From: Von Birne <> Date: Tue, 7 Dec 2021 20:31:15 +0100 Subject: [PATCH] fix the bug with format time for real ice_status['connectivity']['remainingTimeSeconds'] might be None --- .config/i3pystatus/ice-status.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.config/i3pystatus/ice-status.py b/.config/i3pystatus/ice-status.py index 8e77810..f9c9fb6 100755 --- a/.config/i3pystatus/ice-status.py +++ b/.config/i3pystatus/ice-status.py @@ -8,6 +8,8 @@ from sys import exit # bundlewrap.utils.text.format_duration, but trimmed down def format_time(seconds): + if seconds is None: + return "?" components = [] if seconds >= 3600: hours = int(seconds / 3600) @@ -67,7 +69,7 @@ try: ice_status['speed'], next_stop, ice_status['connectivity']['currentState'], - format_time(int(ice_status['connectivity']['remainingTimeSeconds'])), + format_time(ice_status['connectivity']['remainingTimeSeconds']), ice_status['connectivity']['nextState'], )) except Exception as e: