Hi, I am looking for some help on proper syntax in ArcGIS Pro/ Python 3. I am trying to read data from a feature class and write to another feature class. The attribute fields are different so I am reading from source and assigning it to output. I get this error at insertCursor.insertRow(newRow).
Appreciate any input.
def LoadData(fSource, fTarget):
# setup search cursorfields = ['*'] fldShape = "SHAPE@"# target field mapping fldCountry = 'Country'fldCommodity = "Product"constructionYear = "CNSTR_YEAR"try: with arcpy.da.InsertCursor(fTarget, ['*']) as insertCursor: with arcpy.da.SearchCursor(fSource, "*") as cursor: for row in cursor: country = row[cursor.fields.index(fldCountry)] geometry = row[cursor.fields.index(fldShape)] commodity = row[cursor.fields.index(fldCommodity)] constructionYear = row[cursor.fields.index(constructionYear)] newRow = [country, geometry, commodity, constructionYear] insertCursor.insertRow(newRow) except Exception: print(e.args)