]> git.parisson.com Git - timeside.git/commitdiff
Cherry-pick 11807d66ff7483031b325
authorThomas Fillon <thomas@parisson.com>
Tue, 29 Apr 2014 08:12:30 +0000 (10:12 +0200)
committerThomas Fillon <thomas@parisson.com>
Tue, 29 Apr 2014 08:26:58 +0000 (10:26 +0200)
timeside/analyzer/core.py

index 65f024703cc0ad67ee8e223b42fce2a933224d09..c7846be34f17f882d2d1a767e12ba4b77c9bd83f 100644 (file)
@@ -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)