I wrote the code below to list datasets and associated feature classes and shape types (point, polygon, etc.) in an sde. This works fine until I get to the last dataset, Zoning, which contains one feature class and one topology. There, it errors out with "RuntimeError: DescribeData: Method feature type does not exist". Also errors on shapeType if I don't check featureType first.
Guessing this has something to do with desc not liking the topology, but is there a way around this other than catching the exception and then continue? Thanks.
Guessing this has something to do with desc not liking the topology, but is there a way around this other than catching the exception and then continue? Thanks.
Code:
def getLists():
dsList = arcpy.ListDatasets("*")
for ds in dsList:
dsName = ds.split(".")
print dsName[2].upper()
print " - Feature Classes"
fcList = arcpy.ListFeatureClasses("*", "", ds)
if len(fcList) == 0:
print "\t - " + "No feature class in this dataset. \n"
continue
for fc in fcList:
desc = arcpy.Describe(fc)
if desc.featureType == "Simple":
fcName = fc.split(".")
desc = arcpy.Describe(fc)
print "\t - " + fcName[2] + ": " + desc.shapeType
print "\n"