summaryrefslogtreecommitdiffstats
path: root/glances/outdated.py
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2017-03-27 09:08:01 +0200
committernicolargo <nicolas@nicolargo.com>2017-03-27 09:08:01 +0200
commit621d708b8bebe00c59cbe93f012cebbf608a767a (patch)
tree0bdd8c8905b4698282934a08a632ea3f6ad33a7c /glances/outdated.py
parent9b1f54bdff02229255e1cb04ba8c608b9380b59b (diff)
glances-version.db Permission denied #1066
Diffstat (limited to 'glances/outdated.py')
-rw-r--r--glances/outdated.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/glances/outdated.py b/glances/outdated.py
index 76e768b7..2b8fd630 100644
--- a/glances/outdated.py
+++ b/glances/outdated.py
@@ -123,7 +123,7 @@ class Outdated(object):
with open(self.cache_file, 'rb') as f:
cached_data = pickle.load(f)
except Exception as e:
- logger.debug("Cannot read version from cache file: {}".format(e))
+ logger.debug("Cannot read version from cache file: {} ({})".format(self.cache_file, e))
else:
logger.debug("Read version from cache file")
if (cached_data['installed_version'] != self.installed_version() or
@@ -140,8 +140,11 @@ class Outdated(object):
safe_makedirs(self.cache_dir)
# Create/overwrite the cache file
- with open(self.cache_file, 'wb') as f:
- pickle.dump(self.data, f)
+ try:
+ with open(self.cache_file, 'wb') as f:
+ pickle.dump(self.data, f)
+ except Exception as e:
+ logger.error("Cannot write version to cache file {} ({})".format(self.cache_file, e))
def _update_pypi_version(self):
"""Get the latest PyPI version (as a string) via the RESTful JSON API"""