Hiyo,I'm just getting started with Esri's geoprocessing tools and I've got a fairly basic question. I'm trying to copy the value from a field in one shapefile to another shapefile. The field already exists in both shapefiles.I've tried a couple of approaches. My first approach was to
#Make first shapefile into a feature layer so join will work
gp.MakeFeatureLayer_management(shapefile_one_path, shapefile_one_name)
# Join the Shapefiles
gp.AddJoin_management(shapefile_one_name, join_field, shapefile_two_name, join_field, "KEEP_COMMON")
# Then I write the new joined table to disk so I can run calculate field on it.
gp.Select_analysis(shapefile_one_name, "joined_shapefile.shp", "")
Unfortunately, this approach dorked up all of column names.Next, I tried to update the column on the joined table:
#Make first shapefile into a feature layer so join will work
gp.MakeFeatureLayer_management(shapefile_one_path, shapefile_one_name)
# Join the Shapefiles
gp.AddJoin_management(shapefile_one_name, join_field, shapefile_two_name, join_field, "KEEP_COMMON")
# Calculate field...?
gp.CalculateField_management(shapefile_one_name, "field_to_update", "field_to_copy")
This resulted in a "general function failure."Anybody have any tips?