From d2c4c1c77cd8a8409c530c52dcdd99fb628ce13f Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Tue, 29 Apr 2014 10:12:30 +0200 Subject: [PATCH] Cherry-pick 11807d66ff7483031b325 --- timeside/analyzer/core.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/timeside/analyzer/core.py b/timeside/analyzer/core.py index 65f0247..c7846be 100644 --- a/timeside/analyzer/core.py +++ b/timeside/analyzer/core.py @@ -924,10 +924,12 @@ class AnalyzerResultContainer(dict): if isinstance(obj, numpy.ndarray): return {'numpyArray': obj.tolist(), 'dtype': obj.dtype.__str__()} + elif isinstance(obj, numpy.generic): + return numpy.asscalar(obj) else: - return {'value': obj.tolist(), - 'dtype': obj.dtype.__str__()} - raise TypeError(repr(obj) + " is not JSON serializable") + print obj + print type(obj) + raise TypeError(repr(obj) + " is not JSON serializable") json_str = json.dumps([res.as_dict() for res in self.values()], default=NumpyArrayEncoder) -- 2.39.5