AnsweredAssumed Answered

Python - GetCount help

Question asked by ccnrm on Apr 16, 2015
Latest reply on Apr 16, 2015 by xander_bakker

Hi all,

 

I am having trouble getting the arcp.GetCount_management to print the GetCount arcpy.AddMessage in the geoprocessing dialog window;

 

# Get the spatial reference
 spatialRef = arcpy.Describe(template).spatialReference.name
  
#Loop through shapfiles in folder and reproject
 for fc in fcList:
     fcspatialRef = arcpy.Describe(fc).spatialReference.name
     if fcspatialRef != spatialRef:
         arcpy.AddMessage(fc)
         arcpy.Project_management(fc, outFolder + "\\" + fc, template)
         projCount = int(arcpy.GetCount_management(fc).getOutput(0)) 
     else:
         arcpy.CopyFeatures_management(fc, outFolder + "\\" + fc)

# Get the count from GetCount's Result object
     arcpy.AddMessage("{0} datasets have been reprojected to: {1} and saved in {2}".format(projCount, spatialRef, OutFolder))

Outcomes