When i use the python caller i get a translation successful, but it gives no output.
I'm not very good at python, so do any of you have an idea what i did wrong?
When i use the python caller i get a translation successful, but it gives no output.
I'm not very good at python, so do any of you have an idea what i did wrong?
One tip might be to capture some of the Python processing into your FME transaction log https://support.safe.com/s/article/logging-with-python-scripts
In a PythonCaller (or PythonCreator) transformer, messages are added to the logfile with the FMELogFile object, which is part of the fmeobjects. You need to create a logger object: logger = fmeobjects.FMELogFile() and then you will need to send messages to the logger: logger.logMessageString("Hello I am Logging Now")
On what row did you type:
self.pyoutput(feature)
?
As
self.pyoutput(feature)
The purpose of this line is to output the resulting features. At a guess, you’d want this to be on line 25, indented to the same level as line 18.
Having it here will output every feature you input into the pythoncaller
Hello,
If your python script completes without errors but lacks output, check for print statements to ensure results are displayed. Verify input handaling and run the script interactively for step by step debugging. Look for silent errors in the console and test with sample data to confirm expected behavior.
I'm no python expert, but these lines look very strange:
y = 'true' if not feature.getattribute('Score 6 t/m 18') else 'false'
if "bebouwing" in x and y == "true":
I'm pretty certain this will not do what you want it to do.
I did not look into all the PythonCaller code before.
FME is in principal a NoCode application to do all the things you want to do. It looks like you don't have much experience in coding in Python or using Python in FME.
The function you are writing is very easy to do using 1 or 2 transformers, so it looks like you should keep away from the PythonCaller.
Except when your only goal is to learn to use the PythonCaller in general because you are certain that there are things you want to do that FME can't do with basic transformers.