diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2012-06-09 01:56:09 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2012-06-09 01:56:09 (GMT) |
commit | 0396e7ec8c4a2c51ed7f2d2bb672ee74fa539b62 (patch) | |
tree | b8f72a9e8c17ebf0664c33dd503ad8959331c3f9 | |
parent | 2a3df9e1f724c2229aadf92282b87d159ce2bd3f (diff) |
evites errors in download/get lsit
-rw-r--r-- | utils.py | 37 |
1 files changed, 21 insertions, 16 deletions
@@ -43,27 +43,32 @@ def get_logger(): def update_list(): """Download the latest list version""" - remote_file = urllib.urlopen(LIST_DOWNLOAD) - _file = open(LIST_PATH, 'w') - _file.write(remote_file.read()) - _file.close() - remote_file.close() + try: + remote_file = urllib.urlopen(LIST_DOWNLOAD) + _file = open(LIST_PATH, 'w') + _file.write(remote_file.read()) + _file.close() + remote_file.close() + except: + pass def get_store_list(): """Returns the store list""" - f = open(LIST_PATH, 'r') - store_list = [] - e = True - while e: - line = f.readline() - if not(line): - e = False - else: - line = line.replace('\n', '') - l = line.split('|') - store_list.append(l) + try: + f = open(LIST_PATH, 'r') + e = True + while e: + line = f.readline() + if not(line): + e = False + else: + line = line.replace('\n', '') + l = line.split('|') + store_list.append(l) + except: + pass return store_list |