I have a python code at hand to batch the process of feature to point.
In the loop section, it showed that "This object does not support enumeration."
Please kindly point out the error in the code for a beginner.
This code did work for a single shapefile but not for multiple ones.
Please kindly use attached shapefile and have a try. (copying it to two or three)
Please also help with the error in the batch code.
Thanks a lot.
##Script Name: Multi centroid
##Description: Get centroid of shapefiles
##Created By: Elaine Kuo
#Import standard library modules
import win32com.client, sys, os
#Create the Geoprocessor object
GP = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
#Set the input workspace
#GP.workspace = sys.argv
#Set the workspace.
#Set the output workspace
#outWorkspace = sys.argv
#Set the workspace. List all of the feature classes in the dataset
# Create a list of all the features within the workspace.
FCs = GP.ListFeatureClasses()
# Loop through every item in the list that was just generated
for fc in FCs:
# Break out the name, no path or extension, using the describe object.
desc = GP.describe(fc)
featureName = desc.name
# Work the magic.
outFeatureClass = outWorkspace + os.sep + GP.ValidateTableName(featureName, outWorkspace)