From 6b12c90e88b6395d74c94f02b7d1dfb0b6b675ee Mon Sep 17 00:00:00 2001 From: Jerome Lebleu Date: Tue, 17 Dec 2013 01:42:49 +0100 Subject: [PATCH] Fix mean calculation --- yunohost_monitor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yunohost_monitor.py b/yunohost_monitor.py index 9fe84555..059eeb2c 100644 --- a/yunohost_monitor.py +++ b/yunohost_monitor.py @@ -563,8 +563,12 @@ def _calculate_stats_mean(stats): if isinstance(v, dict): s[k] = _mean(v, t, ts) elif isinstance(v, list): - nums = [ float(x * t[i]) for i, x in enumerate(v) ] - s[k] = sum(nums) / float(ts) + try: + nums = [ float(x * t[i]) for i, x in enumerate(v) ] + except: + pass + else: + s[k] = sum(nums) / float(ts) return s stats = _mean(stats, timestamp, t_sum)