I have two GDB's that are the same schema. One is a master GDB that we are appending other individual GDB's into. The GDB's contain several points, polys, lines, and tables as well as 2 datasets with additional feature classes. I've started with a bit of code I found from https://community.esri.com/thread/105313#comments and modified the multiple GDB's to a single. The code appears to do what I want; append feature classes that are within the datasets to the master and append all root feature classes into the master.

When I run the script I get the error

Traceback (most recent call last): File "C:\Python27\Temp\append.py", line 20, in arcpy.Append_management(appendinput,GDBD+'/'+fcr,"TEST") File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 3995, in Append raise e 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).

Since the code specifically lists only feature classes, I'm not sure where the mixed inputs is coming from as tables should not be included. How can I adjust this code? (I'm new to python and coding in general)

import arcpy  
from arcpy import env  
##Destination GDB  
##List of Origin GDB  
##Set Environment  
##Get List of FDS  
##Get List of Root Feature Classes  

##Append elements in Root Feature Classes  
for fcr in ROOTFCS:  
    for FCI in GDBS:  
    ##print appendinput  

##Append elements of Feature Classes inside Feature Datasets  
for FD in FDS:  
    for FC in arcpy.ListFeatureClasses("*","POLYGON",FD):  
        for FCI2 in GDBS:  
        ##print appendinput2  

Your script wants the variable GDBS to be a list. It's a string. This is causing parsing issues.


Strings can be parsed just like lists, one character at a time:

>>> for g in "ABC":
    print g


This is what is happening with the variable GDBS here:

for FCI in GDBS:  

Change the string into a list.

>>> for g in ["ABC"]:
    print g


Or, in your case:

##List of Origin GDB  
GDBS= [r"C:\Python27\Temp\UPRR_CaliforniaModel_20170130_1.gdb"]

Note the r at the start of the string. This is a raw string. File paths generally need the r.

  • Thanks for the help! I had removed the brackets from GDBS. I assumed this was a list from the original script intending to appended multiple GBD's into one. As I was doing one at a time, I thought the brackets were not needed. This solved the issue, thanks for the response. – Dweber Oct 23 '17 at 19:15

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.