updated a machine used for nightly processing from 10.7.1 to 10.8.1. Now I am having issues where I am getting a syntax error on a CalculateField with a function and returns ERROR 000989: Python syntax error: Parsing error SyntaxError: invalid syntax (line 1)
This is the line I have been using for a couple years with no issues.
arcpy.management.CalculateField(finalTable, "SiteAddress", "myFun(!LocationStartNumber!,!StreetDirection!,!StreetName!,!StreetWay!,!UnitNumber!)", "PYTHON_9.3", "def myFun(LocationStartNumber,StreetDirection,StreetName,StreetWay,UnitNumber):\\n if UnitNumber is None:\\n UnitNumber = ''\\n if LocationStartNumber == 0:\\n if StreetName == 'TBD':\\n return StreetName \\n else:\\n val = '{} {} {} {}'.format(StreetDirection,StreetName,StreetWay,UnitNumber)\\n return val.strip()\\n else:\\n return '{} {} {} {} {}'.format(LocationStartNumber,StreetDirection,StreetName,StreetWay,UnitNumber)\\n")
I took the calculate out of the script and run it in ArcMap for now. But not a long term solution. What is going on?