aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorRyan Huber <rhuber@gmail.com>2015-07-22 10:32:22 -0700
committerRyan Huber <rhuber@gmail.com>2015-07-22 10:32:22 -0700
commitc4d6134e539658f12e44e1596216d60e6bf93b0d (patch)
tree8f9378cd7c095a44678c9e7913a0f3f84a7559ed /wee_slack.py
parent0914bff73d8e3abc70fcf4eae4a23164de01385b (diff)
downloadwee-slack-c4d6134e539658f12e44e1596216d60e6bf93b0d.tar.gz
handle the case of an old style cache file (ignore it)
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py8
1 files 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