`ERROR 000468: Input shape types are not equal `

by user10680652   Last Updated December 06, 2018 15:22 PM

Trying to merge shapefiles:


def get_folder(fn, k=-2):
    return os.path.split(fn)[0].split(os.sep)[k]


d = defaultdict(list)
with open(fi +'//' + 'exports' + '//'+'info.txt', 'w') as fw:
    for root, dirs, files in os.walk(fi):
        for shapefile in files:
            if shapefile.endswith('.shp'):
                arcpy.AddField_management(os.path.join(root,shapefile), "field_Tmp", "LONG")
                with arcpy.da.UpdateCursor(os.path.join(root,shapefile),'field_Tmp') as cursor:
                    for row in cursor:
                        row[0] = get_folder(os.path.join(root,shapefile))                   

for cat, lst in d.items():

ERROR 000732: Dataset ad1.shp does not exist or is not supported

Although it exists.

This is because it needs to do the merge 'by name'.

The list now is like this:


So it has to merge:

'C:\\Users\\user\\Desktop\\shape\\430\\ad1\\ad1.shp' with


 'C:\\Users\\user\\Desktop\\shape\\430\\ad2\\ad2.shp', with

I think this is the cause of the error.

Can you suggest a fix?

Tags : arcpy

Related Questions

Update Data Driven Pages Index layer via Python

Updated May 28, 2015 00:09 AM