diff --git a/morss/morss.py b/morss/morss.py index 14741fa..34f7ee0 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -145,10 +145,14 @@ class Cache: self._file = self._dir + '/' + self._hash self._file_tmp = self._file + '.tmp' - if os.path.isfile(self._file): + try: data = open(self._file).read() if data: self._cache = json.loads(data) + except IOError: + pass + except ValueError: + log('JSON cache parse fail') def __del__(self): self.save()