AnsweredAssumed Answered

UpdateCursor, add \\ and \\ to field.

Question asked by CCweedcontrol on Mar 13, 2018
Latest reply on Mar 13, 2018 by CCweedcontrol

I am trying to add \\ and \\ to the front and back of attributes in a filed, for some weird reason it worked fine but today i run the script and i get this error. so I am not sure what's going on?

 

row[1] = "".join(("\\", row[0], "\\"))
TypeError: sequence item 1: expected string, NoneType found

 

FZ = "D:/GIS Folder/test.gdb/CurrentZoning"

arcpy.MakeFeatureLayer_management(FZ,"In_memory\FZ_Lyr")
try:
    if arcpy.Exists("In_memory\FZ_Lyr"):
        arcpy.AddField_management("In_memory\FZ_Lyr", "ZONING_CODE", "TEXT","","",60)
    else:
        print "FZ_Lyr does not exist"
except arcpy.ExecuteError:
    print "Error Occured FZ_Lyr Attribute Failed"

arcpy.FeatureClassToFeatureClass_conversion("In_memory\FZ_Lyr", "D:/GIS Folder/test.gdb", "ZoningMerge1")

with arcpy.da.UpdateCursor("In_memory\FZ_Lyr", ['ZONE_CODE','ZONING_CODE']) as cursor:
            for row in cursor:
                    row[1] = "".join(("\\", row[0], "\\"))
                    cursor.updateRow(row)
            del row

Outcomes