FMEFeature.getAttributeAsType(attrName, attrType, fallback)

This method is deprecated as of FME 2021.0. Please use getAttribute with desired type instead.

Get the value of the named attribute, casted to the specified FME type, then to an appropriate python type.

An optional third parameter can be specified to be returned as a fallback in case type conversion fails.

Example: getAttributeAsType(“output_file_type”, fmeobjects.FME_ATTR_STRING, “png”)

The enum value fmeobjects.FME_ATTR_UNDEFINED can be used to retrieve a list object. If used to try and get a single attribute as a list, or a list as a single type, there is automatic conversion failure.

A return of None indicates the attribute does not exist.

  • attrName (str) – The name of the attribute to get on the feature.

  • attrType (int) – The integer representing the desired FME type.

  • fallback (any) – (Optional) If specified, this value is returned instead of raising FMEException on conversion failures.

Return type:

bool, int, float, str, list[str], bytearray, list[bytearray], bytes, list[bytes], or None


The value of the named attribute.


FMEException – An exception is raised if there was a problem in retrieving or converting the attribute value.