Hello. I posted this question yesterday(<https://community.esri.com/t5/geoprocessing-questions/phython-script-typeerror-range-integer-end-argument-expected-got/m-p/1028834#M25202>) and thought it was solved, but there's another problem found...
I've run the module below. The empty feature class was created but there's no geometrical shapes created.
def main():
import arcpy
import os
fc_in = r"D:\forest\CHISAN\shp\test.gdb\PT_merge" # this one exists
fld_count = "Count"
fc_out = r"D:\forest\CHISAN\shp\test.gdb\PT_merge_duplicate" # this one will be created
sr = arcpy.Describe(fc_in).spatialReference
# create the empty output featureclass
path, name = os.path.split(fc_out)
arcpy.CreateFeatureclass_management(path, name, "POLYGON", fc_in, "SAME_AS_TEMPLATE", "SAME_AS_TEMPLATE", sr)
# insert the features into the output fc
with arcpy.da.SearchCursor(fc_in, '*') as curs_in:
flds_in = curs_in.fields
idx_cnt = flds_in.index(fld_count)
with arcpy.da.InsertCursor(fc_out, '*') as curs_out:
for row in curs_in:
cnt = row[idx_cnt]
for i in range(0,int(cnt)):
curs_out.insertRow(row)
if __name__ == '__main__':
main()
I think something is wrong with "# insert the features into the output fc" part.
Would be very appreciated if someone could lectuer me how to solve this problem.
Thank you.