Cannot delete domain ... with a twist

Discussion created by wroe on Apr 10, 2014
Latest reply on Nov 13, 2014 by xander_bakker
Hi all

I'm working in a file geodatabase and deleting some duplicate domains that have crept in. I've successfully used Python to identify which domains are associated with which fields and, after rejiggering them, have deleted several--except for one, D_LABEL_TYP_1. It does not appear to be associated with any table or feature class (within or without the sole feature dataset) but I still cannot delete it. When I do try to delete it, the error I get ("Failed to delete a domain from the database. The domain is used by an attribute rule.") doesn't jibe with what my Python results are telling me. To wit, here's the exact Python I'm using:

import arcpy
arcpy.env.workspace = "C:\Workspace\template.gdb"

Checking feature classes within the feature dataset:
for FD in arcpy.ListDatasets():
 for FC in arcpy.ListFeatureClasses("","",FD):
  for field in arcpy.ListFields(FC):
   if field.domain == "D_LABEL_TYP_1":
    print FC, field.name, field.domain

Checking feature classes outside the feature dataset:
del FD, FC, field
for FC in arcpy.ListFeatureClasses():
 for field in arcpy.ListFields(FC):
  if field.domain == "D_LABEL_TYP_1":
   print FC, field.name, field.domain

And checking all tables:
del FC, field
for table in arcpy.ListTables():
 for field in arcpy.ListFields(table):
  if field.domain == "D_LABEL_TYP_1":
   print table, field.name, field.domain

I've also tried using just "if field.domain:", which gives me a list of every table-field-domain combination--but I still don't find any fields having the D_LABEL_TYP_1 domain. I've also checked to be sure this domain doesn't have any trailing spaces in its name.

Any ideas why ArcGIS thinks this domain is still attached to an attribute table? As its name suggests, this file geodatabase is a template we use for multiple projects and it's important to get it squared away before we use it.

Thanks, -W