I currently am using the code below to create a List of existing Domains on a Geodatabase, and if there are none to create one. The code does create the domain, but is not creating the list of Domains if they already exist. Did I set up the if statement incorrectly or do I need another function to give me the list of current domains?
I have referenced the following question, How to check if domain already exists? but the print function is not working for me.
domains=arcpy.da.ListDomains(outputGDB)
if len(domains) == 0:
domName = 'DomStatus'
arcpy.CreateDomain_management(r'X:\GIS_PROJECTS\City.gdb', domName, '', 'TEXT', 'CODED')
arcpy.AddCodedValueToDomain_management(r'X:\GIS_PROJECTS\City.gdb', domName, 1, 'Boundary Used')
arcpy.AddCodedValueToDomain_management(r'X:\GIS_PROJECTS\NATIONAL\ParkServe\Documentation\Test_HW\ParkScore_Loading\New_Mexico__Albuquerque.gdb', domName, 2, 'Added')
arcpy.AddCodedValueToDomain_management(r'X:\GIS_PROJECTS\City.gdb', domName, 3, 'Deleted')
arcpy.AddField_management(newFC, 'Status_2017', 'TEXT',field_length=50, field_domain=domName)
print "Domain Created"
else:
print domains
domains=arcpy.da.ListDomains(outputGDB)and then on the next lineprint domains? It should print a number of domain objects although not specifying names. If it's not then there may be something else not working – Midavalo May 09 '17 at 18:52