Skip to main content

Hi there,

 

I am trying to use Python code (which is written externally) in FME by using Python Caller. The purpose of the python program is to create two new attributes after performing manipulation on existing attributes. For this purpose, I create a data frame in the ___init__ of the Python caller, then I use the input function to capture the data that come from different blocks of FME transformation and then do the data manipulation in the close function of Python caller. Now the problem is that this structure slows down the program. I suspect it because of the way I capture the data in the data frame. I have two questions:

1) am I following the right approach to populate the data frame? Is there any better way (quicker) of the populating data frame?

2) Could you please also comment on my general structure of the Python code in Python caller i.e. defining data frame in __init__ function, populating data frame in input function, and final calculation is done in close function?

 

Regards

Yasir

 

 

This sounds about right to me.

If I need to output every input feature, then what I do is create a self.featureList in the __init__. In the input I append each feature to the list. In the close I do all the processing (with helper functions as necessary).

 


This sounds about right to me.

If I need to output every input feature, then what I do is create a self.featureList in the __init__. In the input I append each feature to the list. In the close I do all the processing (with helper functions as necessary).

 

I tried to look at the documentation of featureList, but couldn't find it. Could you please point it out to the right direction?


I tried to look at the documentation of featureList, but couldn't find it. Could you please point it out to the right direction?

my __init__ functions contains the line

self.featureList = []

it's an arbitrary list variable.


Reply