Merge pull request #760 from notFloran/fix-debug-file-not-exist

Debug and WebUI : don't crash when the file does not exist
This commit is contained in:
Nicolas Hennion 2015-12-17 09:30:49 +01:00
commit e217ff7ee5

View File

@ -216,8 +216,11 @@ class GlancesBottle(object):
if self.args.debug:
fname = os.path.join(tempfile.gettempdir(), 'glances-debug.json')
with open(fname) as f:
return f.read()
try:
with open(fname) as f:
return f.read()
except IOError:
logger.debug("Debug file (%s) not found" % fname)
# Update the stat
self.stats.update()