As python in FME has evolved, its gotten a bit stricter with how its setup. I generally reccomend to not make any changes to the initial setup of the PythonCaller.
In older versions you were able to call a function directly like that, but now you need to specify a class for the transformer to call.
in 2024.2 this is how the python caller should look. Note that your above code is in the input function on lines 30 and 32. The transformer is calling the FeatureProcessor class
import fme
from fme import BaseTransformer
import fmeobjects
class FeatureProcessor(BaseTransformer):
"""Template Class Interface:
When using this class, make sure its name is set as the value of the 'Class to Process Features'
transformer parameter.
This class inherits from 'fme.BaseTransformer'. For full details of this class, its methods, and
expected usage, see https://docs.safe.com/fme/html/fmepython/api/fme.html#fme.BaseTransformer.
"""
def __init__(self):
"""Base constructor for class members."""
pass
def has_support_for(self, support_type: int):
"""This method is called by FME to determine if the PythonCaller supports Bulk mode,
which allows for significant performance gains when processing large numbers of features.
"""
return support_type == fmeobjects.FME_SUPPORT_FEATURE_TABLE_SHIM
def input(self, feature: fmeobjects.FMEFeature):
"""This method is called for each feature which enters the PythonCaller."""
fgdb_path = fme.macroValuese'FGDB_PATH']
arcpy.management.CompressFileGeodatabaseData(fgdb_path, "Lossless compression")
self.pyoutput(feature, output_tag="PYOUTPUT")
def close(self):
"""This method is called once all the FME Features have been processed from input()."""
pass
def process_group(self):
"""This method is called by FME for each group when group processing mode is enabled."""
pass
def reject_feature(self, feature: fmeobjects.FMEFeature, code: str, message: str):
"""This method can be used to output a feature to the <Rejected> port."""
feature.setAttribute("fme_rejection_code", code)
feature.setAttribute("fme_rejection_message", message)
self.pyoutput(feature, output_tag="<Rejected>")