Hi @david_allan , from this error message, it seems that you are attempting to call a function called "tester()" with passing an argument but the function can take no arguments.
Python Exception <TypeError>: tester() takes 0 positional arguments but 1 was given
Check the definition of the function "tester()" and call it correctly.
Hi @david_allan , from this error message, it seems that you are attempting to call a function called "tester()" with passing an argument but the function can take no arguments.
Python Exception <TypeError>: tester() takes 0 positional arguments but 1 was given
Check the definition of the function "tester()" and call it correctly.
Thanks for the reply @takashi . I checked the function name and they seem to match. I have attached a screen shot of a simple function that I am calling. When the Python Creator runs, the print statement prints, but I receive the <TypeError> message. Is it possible to run custom python scripts within Python Creators/Callers?
Thanks for the reply @takashi . I checked the function name and they seem to match. I have attached a screen shot of a simple function that I am calling. When the Python Creator runs, the print statement prints, but I receive the <TypeError> message. Is it possible to run custom python scripts within Python Creators/Callers?
I think you need to use the FME class template as a starting point (although don't quote me on that!)
import os
import sys
def execute():
print ("Hello World")
class FeatureCreator(object):
def __init__(self):
pass
def input(self,feature):
pass
def close(self):
if __name__ == '__main__':
execute()
@david_prosack88
The issue is the parameter for oClass to Process Features]. You use directly the function oexecute] and it's not legit.
The class or the function you want to use with PythonCaller must respect one of these pattern:
If you want to call a Method, the signature must be: eFunction Name](feature):
def execute(feature):
pass #Enter your code here. Every features that pass through here will be output.
If you want to call a Class, the signature must be:
class MyClass(object):
def input(self):
pass #This is the constructor called only one time.
def input(self, feature):
self.pyoutput(feature) #Let out the incomming feature. So you need to add lines before for any logical things to do.
#self.pyoutput let you decide if you want or not to let the feature to out.
def close(self):
pass #Called only once when no other features will incomming in this PythonCaller.
Hope this information will help you out.
Jean
Thanks for the reply @takashi . I checked the function name and they seem to match. I have attached a screen shot of a simple function that I am calling. When the Python Creator runs, the print statement prints, but I receive the <TypeError> message. Is it possible to run custom python scripts within Python Creators/Callers?
Could you please share the script you wrote in the PythonCreator with us?