I think I have problem with basics about FME and Python

I think I have problem with basics about FME and Python

I try to learn from Oliver's corner instruction . So for example I overwrite his #script 4 to StartupPython Script some below and set input data in workflow with name "Fruits":

class MyPythonFactory(object): def __init__(self): self.count_features = 0 self.logger = pyfme.FMELogfile() def input(self,feature): self.count_features += 1 # Accessing all attributes of a feature self.all_attributes = 'Tile'.getAllAttributeNames() # return a list with all attribute names as result self.all_attributes_count = len(self.all_attributes) # count attributes self.logger.log('Feature: '+ str(self.count_features),1) for i in range(self.all_attributes_count): self.attribute_name = self.all_attributes[i] # get attribute name self.attribute_value = 'Tile'.getAttribute(self.attribute_name) # get attribute value self.logger.log('Attribute: ' + str(self.attribute_name) + '	Value: ' + str(self.attribute_value), 1) self.logger.log('
',1) self.pyoutput('Tile') def close(self): self.logger.log('Total number of features: ' + str(self.count_features),1)

And according to this I should get following results in log file:

Feature: 1 Attribute: X_INT Value: 3333317 Attribute: ID Value: 1 Attribute: fme_type Value: fme_point Attribute: LASTNAME Value: von Goethe Attribute: Y_INT Value: 5684892 Attribute: fme_feature_type Value: points Attribute: fme_geometry Value: fme_point Attribute: SHAPE_GEOMETRY Value: shape_point Attribute: X_FLOAT Value: 3333317 Attribute: SURNAME Value: Johann Wolfgang Attribute: Y_FLOAT Value: 5684892

But I do not get any results of this script in logfile!

So my questions are:

  1. How script recognize which feature I will use If there are more? Is feature name actually name of input data for example, so I should use 'Fruits'?
  2. Do I have to replace word 'feature' in code with corresponding feature name in workbench?

That Python snippet is not appropriate for a Startup Python Script. It's purpose is to process features, so you need to place it in a PythonCaller transformer.

Startup Python Scripts would not typically operate on features, but could be used to do more generic preparation before the workspace is run.