SyncSurvey
SyncSurvey copied to clipboard
getSurveyTables errors when tables don't exist
Hi james,
Just working my way thru your great script and stuck on getSurveyTables. This is a 1st run of the tool, so there are no feature classes or tables to get. The listFeatureClasses and ListTables functions return 'None'. So the allTables.extend fails on the None Type.
featureClasses = arcpy.ListFeatureClasses(wildcard)
print featureClasses
tables = arcpy.ListTables(wildcard)
print tables
#Loop through the tables, checking for:
#1) Is this an attachment table?
#2) Does the prefix actually match the prefix term exactly?
allTables = featureClasses
allTables.extend(tables)
Will this script create the feature classes and tables if they don't exist?
Checking for empty table lists fixed the issue on 1st run...
featureClasses = arcpy.ListFeatureClasses(wildcard)
print featureClasses
if featureClasses == None:
featureClasses = []
tables = arcpy.ListTables(wildcard)
print tables
if tables == None:
tables = []