My goal is to delete all rows in an existing feature class, then append new rows from a new shapefile... everything works except for the append. The table-view portion as the input is giving me the trouble. I am working in ArcGIS Desktop 10.5.1
I got all the code working fine except for the append, it produces this error:
Traceback (most recent call last):
File "C:\Users\jhead\Desktop\UpdateCursor_Append.py", line 30, in <module>
arcpy.Append_management(sourceView, emptyFC, 'TEST')
File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\management.py", line 4271, in Append
raise e
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a Table View.
ERROR 000840: The value is not a Raster Layer.
Failed to execute (Append).
My code is below:
emptyFC = r"Database Connections\TEST ENVIRONMENT.sde\TEST_ENVIRONMENT.DBO.featureclass"
sourceSHP = r"path\to\file.shp"
sourceDBF = r"path\to\output\folder"
print 'Converting new parcels to DBASE'
arcpy.TableToDBASE_conversion(sourceSHP,sourceDBF)
print ' Converting was successfull!'
print 'creating temporary table view in memory...'
sourceDBF2 = r"path\to\file.dbf"
sourceView = arcpy.MakeTableView_management(sourceDBF2, "sourceView")
print ' Appending new rows to existing Feature Class...\n'
arcpy.Append_management(sourceView, emptyFC, 'TEST')
According to the documentation I should be able to use a shapefile as an input data set, but using the shapefile also produces the exact same error as the table view.
http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/append.htm
arcpy.Append_management([sourceView], emptyFC, 'TEST')
– Kadir Şahbaz Apr 12 '18 at 20:43sourceView
andemptyFC
must match. You sure they are matched? – Kadir Şahbaz Apr 12 '18 at 20:58