Skip to main content

I have a python code, here is an example, how will I set it up in a Python Startup Script or even a Pythoncaller. Here is a sample code. I know some might be able to do everything I am trying to do in FME, for the moment I will like to use my available python codes in FME, hence my question.

def my_function(food):

for x in food:

print(x)

fruits = ["apple", "banana", "cherry"]

my_function(fruits)

 

Assuming that your "real" code doesn't depart from the sample code in a major way, I can't see why it shouldn't work pretty much as-is.

Have you tried simply copying your code into the startup script? What happened?


There's some tutorials that should help you get underway: https://knowledge.safe.com/articles/706/python-and-fme-basics.html


Assuming that your "real" code doesn't depart from the sample code in a major way, I can't see why it shouldn't work pretty much as-is.

Have you tried simply copying your code into the startup script? What happened?

I am able to successfully run it in the startup and shutdwon script, just not in the pythoncaller. My goal is to be able to pass values from the pythoncaller directly to a transformer in FME without having to save the data somewhere locally before proceeding in my workflow. Will like the pythoncaller to hand over to a transformer in same workspace.

Thanks


I am able to successfully run it in the startup and shutdwon script, just not in the pythoncaller. My goal is to be able to pass values from the pythoncaller directly to a transformer in FME without having to save the data somewhere locally before proceeding in my workflow. Will like the pythoncaller to hand over to a transformer in same workspace.

Thanks

If you can post a minimal workspace here that demonstrates what you want to accomplish, perhaps we can help you find a solution.