3

I am attempting to write a stand alone python script which will loop through the first GDB and append each feature class to its corresponding feature class in the second GDB. The error code that I keep getting is:

"ExecuteError: Failed to execute. Parameters are not valid. ERROR 000338: Inputs must be either all Feature Classes, Tables or Rasters; not mixed. Failed to execute (Append)."

I believe this has to do with reading the pathways to the GDB. It is important to note that with in the second GDB the target feature class is within a feature dataset. My arc version is 10.2 if this matters.

import arcpy
import os
import traceback

#Set up workspace
outworkspace = "C:\\Users\\bjbart\\Desktop\\Marathon_Loading\\SURVEY_POINTS_V10_1.gdb"
workspace = "C:\\Users\\bjbart\\Desktop\\Marathon_Loading\\out.gdb"

arcpy.env.workspace = workspace

#loops through the first GDB 
featureclasses = arcpy.ListFeatureClasses()

for fc in featureclasses:

    shp_file = fc
    print fc


    if shp_file == "BEND":
        arcpy.Append_management(os.path.join(workspace, "shp_file"), "C:\\Users\\bjbart\\Desktop\\Marathon_Loading\\SURVEY_POINTS_V10_1.gdb\\PIPE_FEATURE\\BEND", "NO_TEST", "","")

        print('BEND File Has Been Appended To Target Database')

    else: print('Error shape file did not get read')'
2

For the script shown here as-is, I think the first error is located in the way we've passed our input dataset parameter to the arcpy.Append_management() tool. It appears that we are attempting to append a feature class called "shp_file" rather than passing the string variable called shp_file, which you have created a few lines above.

For this issue, maybe do the following? Please note the removal of quotes on shp_file:

if shp_file == "BEND":
        arcpy.Append_management(os.path.join(workspace, shp_file), "C:\\Users\\bjbart\\Desktop\\Marathon_Loading\\SURVEY_POINTS_V10_1.gdb\\PIPE_FEATURE\\BEND", "NO_TEST", "","")

Good luck here - after this first feature class is appended successfully you could create additional if conditions to append the remaining feature classes as needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.