Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We want to check if feature classes are empty in the ToolValidator.

When you call GetCount_managment() and background processing is on, there is a popup from our validation step.

Is there a different method to find if a feature class is empty, other than using GetCount_management?

share|improve this question
up vote 3 down vote accepted

Try a search cursor?

class ToolValidator:

    def __init__(self):
        import arcpy
        self.params = arcpy.GetParameterInfo()

    def initializeParameters(self):
        fc = self.params[0]
        rows = arcpy.SearchCursor(fc)
        if #At least one feature
            #Do something
            #Do something else
share|improve this answer
Thanks. I should have thought of that! I posted the function I used. – Michael A. Jackson Nov 24 '11 at 0:26
import arcpy

def isEmpty(table):
    """ Return true if table has no rows."""

    return not arcpy.SearchCursor(table).next()
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.