SyncSurvey icon indicating copy to clipboard operation
SyncSurvey copied to clipboard

getSurveyTables errors when tables don't exist

Open jgustine opened this issue 8 years ago • 1 comments

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?

jgustine avatar Feb 15 '17 19:02 jgustine

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 = []

jgustine avatar Feb 15 '17 22:02 jgustine