Hi all,
I have problem with small script removing accents from letters, it worked fine in FME Desktop 2018 and after upgrading it to 2019 gives me errors like:
"
Python Exception <NameError>: name 'unicode' is not defined
Error encountered while calling function `strip_accents'
API_POI_Name-strip (PythonFactory): PythonFactory failed to process feature
A fatal error has occurred. Check the logfile above for details
Bridge failed to output feature on tag `PYOUTPUT'
"
Why is so?
import fme
import fmeobjects
import sys
import reload(sys)
sys.setdefaultencoding("utf-8")
import re
import unicodedata
def strip_accents(feature):
n1 = feature.getAttribute('Name_1')
n2 = feature.getAttribute('Name_2')
nkfd_form = unicodedata.normalize('NFKD', unicode(n1))
t1 = u"".join(pc for c in nkfd_form if not unicodedata.combining(c)])
nkfd_form = unicodedata.normalize('NFKD', unicode(n2))
t2 = u"".join(ic for c in nkfd_form if not unicodedata.combining(c)])
feature.setAttribute('Name_1', t1)
feature.setAttribute('Name_2', t2)