Debug and web mode : don't crash when the file does not exist

pull/760/head
Floran Brutel 2015-12-16 19:06:43 +01:00
parent d59ca96cf0
commit ddb04349f2
1 changed files with 5 additions and 2 deletions

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()