Hey All,I am running a script that will analyze feature classes, feature datasets, and tables in a workspace. If I encounter a workspace that has no feature datasets (for example) the logic moves into the except statement and doesn't execute analyze on tables. Instead of failling, I would like to see a warning in the output, but continue stepping through the try: block. Any help is greatly appreciated!# Analyze
try:
env.workspace = dbconnection
fclist = arcpy.ListFeatureClasses() # <-- executes as expected
for fc in fclist:
arcpy.Analyze_management(fc,'BUSINESS;FEATURE;ADDS;DELETES')
output.write(" " + fc + " has been analyzed\n")
fdlist = arcpy.ListFeatureDatasets() # <-- FAIL!!!
for fd in fdlist:
arcpy.Analyze_management(fd,'BUSINESS;FEATURE;ADDS;DELETES')
output.write(" " + fd + " has been analyzed\n")
tablist = arcpy.ListTables() # <-- Doesn't execute
for tab in tablist:
arcpy.Analyze_management(tab,'BUSINESS')
output.write(" " + tab + " has been analyzed\n")
output.write(" arcpy.analyze finished successfully\n")
except:
output.write("!!arcpy.analyze didn't work right\n")
err_list = str(sys.exc_info())
for err in err_list.split('\\n'):
output.write(" " + err + "\n")