Skip to main content

Hi,

 

My workspace attached only takes information from the Website and shows values in the log.

 

How Can I expose the response in attributes using Python caller?

 

Thank´s

Hi @mr_fme​ ,

In the Python script, you can add a pair of name and vlaue to the input feature object as a feature attribute with FMEFeature.setAttribute method, as in:

 

feature.setAttribute(attribute name, attribute value)

 

Then, expose the attribute name with the "Attributes to Expose" parameter in the PythonCaller or with a subsequent AttributeExposer transformer, if necessary.  


Thank´s, but where I need to put it?

 

In begining...

Python Exception <NameError>: name 'feature' is not defined

 

In the final...

Python Exception <IndentationError>: unindent does not match any outer indentation level

 

 


Thank´s, but where I need to put it?

 

In begining...

Python Exception <NameError>: name 'feature' is not defined

 

In the final...

Python Exception <IndentationError>: unindent does not match any outer indentation level

 

 

Write within the "processFeature" function, like this.

def processFeature(feature):
    ...
    feature.setAttribute("example", 1)

 


Write within the "processFeature" function, like this.

def processFeature(feature):
    ...
    feature.setAttribute("example", 1)

 

No work, unfortunately.

 

image


Write within the "processFeature" function, like this.

def processFeature(feature):
    ...
    feature.setAttribute("example", 1)

 

Make sure indentations of the script are correct. Note that a single tab and some spaces look like the same width, but those are different in the number of characters and could cause the error. 


Write within the "processFeature" function, like this.

def processFeature(feature):
    ...
    feature.setAttribute("example", 1)

 

Thank´s


Reply