I needed to dump all of the domains in my file geodatabase so missing values can be identified. The script runs fine if the domain name has no spaces but, unfortunately this one has many multi-word domain names. Renaming the domains isn't practical and ModelBuilder is not an option. I can list (ListDomains) all of the domains, regardless of the name and loop through everyone of them. The Toolbox version successfully but there are too many domains for that. Here is the script.
import arcpy domains = arcpy.da.ListDomains(pathname) fileout = open('filename', 'w') for domain in domains: name = domain.name print(name) txtline = name,'\n' fileout.writelines(txtline) arcpy.DomainToTable_management(inTable,name,outTable + name,"Code","Description") fileout.close()