Skip to main content
Question

Erstellung eines Features mit pythonCreator


arash_hokm
Contributor
Forum|alt.badge.img+8

Hello FME Community,

 

I get the following error message when creating features in FME using PythonCreator. Does anyone know what the problem is?PythonCreator

2 replies

geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • December 14, 2023

According to the error message, there is no method input(self, feature) in your Python code.

This method is present when you open a new PythonCreator, so you may have removed it.

import fmeobjects
 
 
class FeatureCreator(object):
    """Template Class Interface:
    When using this class, make sure its name is set as the value of the 'Class to Process Features'
    transformer parameter.
    """
    
    def __init__(self):
        """Base constructor for class members."""
        pass
        
    def input(self, feature: fmeobjects.FMEFeature):
        """This method is called once by FME to initiate feature creation.
        Any number of features can be created and emitted by the self.pyoutput() method.
        The initial feature argument is a placeholder and can be ignored.
        """
        newFeature = fmeobjects.FMEFeature()
        self.pyoutput(newFeature)
        
    def close(self):
        """This method is called at the end of the class."""
        pass

 


hkingsbury
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • December 17, 2023

Building on the comment by @geomancer​ , the code in your close function needs to be in the input function


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings