From: W. Trevor King Date: Sat, 8 Dec 2012 23:58:11 +0000 (-0500) Subject: emerge-lastsync.py: handle the never-synced case X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ef5abc3fa58357229828530ca2f0f797676ef542;p=mw2txt.git emerge-lastsync.py: handle the never-synced case --- 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')