Skip to main content

I have a pythoncaller, that runs the below python, this works OK in FME 2018, but fails in 2020.

ERROR |Python Exception <SyntaxError>: invalid syntax (<string>, line 11)

FATAL |Factory proxy not initialized

I have the python interpreter set to 3.6+

So the script works in 2020 if I tag out the last line, so has something changed with the feature.removeAttribute function ?

 

import fmeobjects

def removeNulls(feature):

attrsin = feature.getAttribute('SRC_ATTRS')

attrs = attrsin.split(',')

for attr in attrs:

val = feature.getAttribute(attr)

if val == 'VCP' :

feature.setAttribute('attname',attr)

if val <> 'VCP' :

feature.removeAttribute(attr)

Isn't the syntax error the if-clause val <> 'VCP'? It should be val != 'VCP' to be correct in Python 3. Seemingly, it works in Python 2 with "a" <> "b".


Yep, that is it, you can tell I am not up on python, really appreciate the


Yep, that was it, you can tell I am not up on python, really appreciate the help.


Yep, that was it, you can tell I am not up on python, really appreciate the help.

No problems! I didn't know you could write <> not equals-statements in Python 2, so we've both learned!


Reply