AnsweredAssumed Answered

Calculate field expression for string concatenation - Python 3.5

Question asked by gardta on Jul 11, 2017
Latest reply on Jul 17, 2017 by rastrauch

After updating a script from Python 2 to Python 3, I am now getting an 'ERROR 00539: Indentation Error: Unexpected indent <<expression>, line 1' on a line in my script. The line is not indented, and I tried removing all spaces and also re-adding spaces (ensuring no tabs were used). I am not sure where the error is. The line ran without error using Python 2.


This is the original line:


arcpy.CalculateField_management (SubLayer_pp_trans_GUJoin_UniqueSubs, "SUB1SUB2", ' [SUB_1] + "," + [SUB_2] ')


I've tried: 

arcpy.CalculateField_management(SubLayer_pp_trans_GUJoin_UniqueSubs,"SUB1SUB2",' !SUB_1! +","+ !SUB_2! ')

and (and various renditions of removing spaces)

arcpy.CalculateField_management(SubLayer_pp_trans_GUJoin_UniqueSubs,"SUB1SUB2",' [SUB_1] + "," + [SUB_2] ')

with no luck. Any suggestions?