From 0cd8d1da6ab53966ba158569915bc8008c85fb03 Mon Sep 17 00:00:00 2001 From: Thijs Mergaert Date: Fri, 5 Aug 2016 13:22:48 -0700 Subject: [PATCH] Fix emitting of tuples from bolts with Python 3 In Python 3, the map() function no longer returns a list, but instead an iterable object, which is not JSON serializable. To fix this, convert the result of the map() call to a list with the list() function. This is still compatible with Python 2 (although will create a copy of the list). --- storm-multilang/python/src/main/resources/resources/storm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storm-multilang/python/src/main/resources/resources/storm.py b/storm-multilang/python/src/main/resources/resources/storm.py index 9106390b499..16fa82fcd41 100755 --- a/storm-multilang/python/src/main/resources/resources/storm.py +++ b/storm-multilang/python/src/main/resources/resources/storm.py @@ -109,7 +109,7 @@ def emitBolt(tup, stream=None, anchors = [], directTask=None): m = {"command": "emit"} if stream is not None: m["stream"] = stream - m["anchors"] = map(lambda a: a.id, anchors) + m["anchors"] = list(map(lambda a: a.id, anchors)) if directTask is not None: m["task"] = directTask m["tuple"] = tup