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.
Thanks
<SPAN class="" style="color: var(--highlight-comment); border: 0px; font-weight: inherit; font-size: 13px;">def LoadData(fSource, fTarget):
# setup search cursor</SPAN>fields = [<SPAN class="" style="color: var(--highlight-variable); border: 0px; font-weight: inherit; font-size: 13px;">'*'</SPAN>] fldShape = <SPAN class="" style="color: var(--highlight-variable); border: 0px; font-weight: inherit; font-size: 13px;">"SHAPE@"</SPAN><SPAN class="" style="color: var(--highlight-comment); border: 0px; font-weight: inherit; font-size: 13px;"># target field mapping </SPAN>fldCountry = <SPAN class="" style="color: var(--highlight-variable); border: 0px; font-weight: inherit; font-size: 13px;">'Country'</SPAN>fldCommodity = <SPAN class="" style="color: var(--highlight-variable); border: 0px; font-weight: inherit; font-size: 13px;">"Product"</SPAN>constructionYear = <SPAN class="" style="color: var(--highlight-variable); border: 0px; font-weight: inherit; font-size: 13px;">"CNSTR_YEAR"</SPAN><SPAN class="" style="color: var(--highlight-keyword); border: 0px; font-weight: inherit; font-size: 13px;">try</SPAN>: <SPAN class="" style="color: var(--highlight-keyword); border: 0px; font-weight: inherit; font-size: 13px;">with</SPAN> arcpy.da.InsertCursor(fTarget, [<SPAN class="" style="color: var(--highlight-variable); border: 0px; font-weight: inherit; font-size: 13px;">'*'</SPAN>]) <SPAN class="" style="color: var(--highlight-keyword); border: 0px; font-weight: inherit; font-size: 13px;">as</SPAN> insertCursor: <SPAN class="" style="color: var(--highlight-keyword); border: 0px; font-weight: inherit; font-size: 13px;">with</SPAN> arcpy.da.SearchCursor(fSource, <SPAN class="" style="color: var(--highlight-variable); border: 0px; font-weight: inherit; font-size: 13px;">"*"</SPAN>) <SPAN class="" style="color: var(--highlight-keyword); border: 0px; font-weight: inherit; font-size: 13px;">as</SPAN> cursor: <SPAN class="" style="color: var(--highlight-keyword); border: 0px; font-weight: inherit; font-size: 13px;">for</SPAN> row <SPAN class="" style="color: var(--highlight-keyword); border: 0px; font-weight: inherit; font-size: 13px;">in</SPAN> 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) <SPAN class="" style="color: var(--highlight-keyword); border: 0px; font-weight: inherit; font-size: 13px;">except</SPAN> Exception: print(e.args[<SPAN class="" style="color: var(--highlight-namespace); border: 0px; font-weight: inherit; font-size: 13px;">0</SPAN>])