From ef5abc3fa58357229828530ca2f0f797676ef542 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 8 Dec 2012 18:58:11 -0500 Subject: [PATCH] emerge-lastsync.py: handle the never-synced case --- posts/conky/emerge-lastsync.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/posts/conky/emerge-lastsync.py b/posts/conky/emerge-lastsync.py index 398524e..9ef908a 100755 --- a/posts/conky/emerge-lastsync.py +++ b/posts/conky/emerge-lastsync.py @@ -12,4 +12,7 @@ for line in open('/var/log/emerge.log', 'r'): sync_time = int(line[:10]) syncs.append(sync_time) -print(time.strftime('%a, %b %e', time.localtime(syncs[-1]))) +if syncs: + print(time.strftime('%a, %b %e', time.localtime(syncs[-1]))) +else: + print('never') -- 2.26.2