I'm currently working on a script that will take 5 parameters from the user: a workspace, a new folder name, 2 file GDBs, and a feature class. The script will create a new folder inside the workspace specified by the user. I needed the new name variable to get the full name of one of the file GDBs with the slash in front of it in order to create a file path. db1 then gets copied to the new folder.
Everything down to the copy function works. I'm having issues with the append function. I need the append to take a feature class from DB2 and append it to the feature class in DB1. But whenever I run the script, I get the following error:
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 understand that I need my input and target to both have the Feature Class data type. Based on what I've coded, DB2_Figure8 is being read as a string due to the GetParameterAsText function. The westFigure8 variable is also a string. The westFigure8 variable is supposed to be a file path into the copied file GDB to access one of the feature classes in that file GDB. So I have 2 strings that need to have the Feature Class data type instead but I'm not sure how to make that happen.
Any suggestions would be greatly appreciated!
#import necessary modules
#Get parameters set by user.
arcpy.env.workspace = arcpy.GetParameterAsText(0) #sets the workspace
folderName = arcpy.GetParameterAsText(1) #allows user to name the folder. folder name should be the date i.e. #mmddyy
DB1 = arcpy.GetParameterAsText(2) #the file GDB that will be copied to the new location
DB2 = arcpy.GetParameterAsText(3) #the second file GDB that will be appended to the original file GDB
DB2_Figure8 = arcpy.GetParameterAsText(4) #the TCOMM_FIGURE8 feature class from the second file GDB
newFolder = arcpy.CreateFolder_management(arcpy.env.workspace, folderName) #creates the new folder with data #type Folder
newName = DB1[-13:] #takes the string which contains the file path for the file GDB that will be copied and truncates #the name so it is left with the final slash to the end of the file name i.e. \WestTTMP.gdb
newPath = str(newFolder) + newName #takes the new folder and converts to a string then combines it with the #truncated file name to create a new file path for the file GDB
arcpy.Copy_management(DB1, newPath) #takes the DB1 file GDB and copies it to the new location
westFigure8 = newPath + "/" + "TCOMM_FIGURE8"
arcpy.Append_management("DB2_Figure8", "westFigure8", "TEST", "", "")