Hi,I'm just digging up this old thread. I am trying to check the existence of domains in my file geodatabase which contains 4 domains (automatically populated after I created some annotation feature classes). My code is as follows:
import arcpy
workspace = env.workspace = r"Z:\Test.gdb"
desc = arcpy.Describe(workspace)
domains = desc.domains
for domain in domains:
if arcpy.Exists(domain):
print domain
The issue I have is the behavior of the 'Exists' method'. When I set a conditional sentence to:
if arcpy.Exists(domain):
print domain
the domains does not print. I'm thinking the code reads like 'If the domain exists, then print out the domain'. Because I have 4 domains, it should print these, but it doesn't.I tried the reverse:
if not arcpy.Exists(domain):
print domain
In this case, the domain gets printed out which seems counter intuitive. To me this reads like 'If the domain does not exists, then print the domain which should return nothing because it does not exist'The problem I have with the code example in the last post is, it doesn't use the 'Exists' method. I want to test if any domains exists, instead of using a conditional statement to test if specific domains exist.Thanks,Mike