Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

If a feature class is in list → Process

$
0
0
Hello,
I am running into a few errors trying to do something seemingly simple. I would like to generate a list of feature classes in a set of subfolders. If there is a specific feature class name in the list I would like to append this data to a dataset. I would like this to work for any feature class with the specific name as there will be many with the same name in different folders. I am able to list the Feature classes just fine but I cant get the syntax for finding the specific ones and appending them.
This is what I have:
Code:

def main():
    try:
        import arcpy, sys, traceback, os, glob, shutil
        arcpy.env.overwriteOutput = True
        log = r'Q:\1-EMPLOYEE INBOX\David\downloads\logSurveyData.txt'
        masterFolder = r"Q:\Field Data\P.M.M\TO_PAM"
        outFolder = r"P:\Projects\SurveyData\DATA\Master.gdb\SMON"
        dst = r'Q:\GIS\Field_Data\z_archive'
       
    #  shutil.copytree(masterFolder, dst + time.strftime('%m_%d_%y'))
       

        #collect a list of subfolders in master folder
        arcpy.env.workspace = masterFolder
        arcpy.ListWorkspaces('','Folder')
        subfolderLst = arcpy.ListWorkspaces('','Folder')
        print subfolderLst
        for subfolder in subfolderLst:
            arcpy.env.workspace = subfolder
            fcLst = arcpy.ListFeatureClasses()
            print fcLst
           
           
            for fc in fcLst("SectMon_PLSS_"):
                    arcpy.Append_management(fc, outFolder)

    except:
        print arcpy.GetMessages()
            # Get the traceback object '"' + wildcard + '"'
        tb = sys.exc_info()[2]
        tbinfo = traceback.format_tb(tb)[0]

        # Concatenate information together concerning the error into a
# message string
        pymsg = tbinfo + "\n" + str(sys.exc_type)+ ": " + str(sys.exc_value)

# Return python error messages for use with a script tool
        arcpy.AddError(pymsg)

# Print Python error messages for use in Python/PythonWin
        print pymsg
   

if __name__ == '__main__':
    main()


Right now the error I am seeing is this
Code:

<type 'exceptions.TypeError'>: 'list' object is not callable
That being said even if the list worked I dont know if it would amend.

Thanks!

Viewing all articles
Browse latest Browse all 2485

Trending Articles