From c4d6134e539658f12e44e1596216d60e6bf93b0d Mon Sep 17 00:00:00 2001 From: Ryan Huber Date: Wed, 22 Jul 2015 10:32:22 -0700 Subject: handle the case of an old style cache file (ignore it) --- wee_slack.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wee_slack.py b/wee_slack.py index bcec026..f962115 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -1683,9 +1683,11 @@ def cache_write_cb(data, remaining): def cache_load(): global message_cache try: - cache_file = open("{}/{}".format(WEECHAT_HOME, CACHE_NAME), 'r') - for line in cache_file: - message_cache.append(line) + file_name = "{}/{}".format(WEECHAT_HOME, CACHE_NAME) + if sum(1 for line in open('myfile.txt')) > 2: + cache_file = open(file_name, 'r') + for line in cache_file: + message_cache.append(line) except IOError: #cache file didn't exist pass -- cgit