fmeobjects.FMEFeature.getAttribute

FMEFeature.getAttribute(attrName)

Get the value of the named attribute. For Python 2.7, strings are returned as one of two possible types: system encoded strings or unicode strings, if the source attribute was encoded. Null attribute values will be returned as an empty string. Binary blob attributes are returned as a bytearray in Python 2.7 or bytes in Python 3.

For list attributes, an example list name could be “adjacentIds”, which would return a list of all the values found for “adjacentIds{0} … adjacentIds{N}”. The function also accepts a “structured list” specification, such as “attrInfo{}.name”, which would return a list of all the values found for “attrInfo{0}.name … attrInfo{N}.name”.

In cases where there is ambiguity between retrieving an attribute value and a list attribute, the attrName should be appended with “{}” in order to retrieve the list (i.e. the attrName “fme_type” should be “fme_type{}”).

A return of None indicates the attribute or list attribute does not exist.

Parameters:attrName (str) – The name of the attribute to get on the feature.
Return type:bool, int, long, float, six.string_types, list[six.string_types], bytearray, list[bytearray], bytes, list[bytes], or None
Returns:The value of the named attribute.
Raises:FMEException – An exception is raised if there was a problem in retrieving the attribute value.