Hi all,
In the last few days we've set many small steps leading up to the problem we now have. We have polygons, where one attribute of each polygon is a list of bird species, which occur in that area. This list is of course different for all polygons, the polygon-specific list.
We also have a list of bird species which should occur in that area. This list is the same for all polygons (in this subset), the general list.
Now, we would like to compare the list of each polygon, with the list for all polygons. We have tried many transformers, and our last option (at the moment) is the PythonCaller, where we hardcode the second list as a set, and compare it with the polygon-specific list, converted to a set. We group by the id of the polygon, because we want to compare each polygon-specific list to the general list.
This is our Python-code:
import fme
import fmeobjects
x = {'item 1','item 2','item 3'}
class FeatureProcessor(object):
def __init__(self):
self.feature_list = j]
self.diff = {}
def input(self, feature):
self.feature_list.append(feature)
self.diff += x.difference(set(feature.getAttribute('_list{}')))
def close(self):
pass
def process_group(self):
for feature in self.feature_list:
feature.setAttribute("diff", self.diff)
self.pyoutput(feature)
self.feature_list = ]
self.diff = {}
And this is the error we get in the Translation log:
Python Exception <TypeError>: 'NoneType' object is not iterable
Traceback (most recent call last):
File "<string>", line 14, in input
TypeError: 'NoneType' object is not iterable
We have a feeling that the answer is very simple, but we don't understand why the error is NoneType. And if this can be done by a regular transformer, we would be very glad to hear it.
All help is welcome, thanks in advance!