Hi msiemens , first, thank you for your amazing efforts with the TinyDB module!
Here's a code snippet (full source code is rather large), I hope this is enough for you:
def updateAttr():
def transform(_elem):
_value = evaluateTargetExpression(_tgtValue, _elem) # calculate _tgtValue
_elem[_tgtAttr] = _value
_eid = _elem.eid
updateFeature = _allFeatures.get(_eid, None)
if updateFeature:
updateFeature.setAttribute(_tgtAttr, _value)
_allFeatures[_eid] = updateFeature
return transform
eids = []
if not _rule or _rule is None:
eids = db.update(updateAttr()) # <=== failing here, updateAttr() is not called
else:
print 'set attr, rule: '+_ruleStr
eids = db.update(updateAttr(), _rule)
The error that I'm receiving is:
Python Exception <TypeError>: 'NoneType' object is not callable
Traceback (most recent call last):
File "<string>", line 291, in close
File "C:\Users\nicholasr\Documents\FME\Plugins\Python\tinydb\database.py", line 394, in update
cond, eids
File "C:\Users\nicholasr\Documents\FME\Plugins\Python\tinydb\database.py", line 249, in process_elements
if cond(data[eid]):
TypeError: 'NoneType' object is not callable