Skip to main content
edited tags
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Arcpy Delete Deleting Multiple Layers using ArcPy with ArcMap

I'm writing an add-in for Arcmap and at the end of it I am left with multiple layers from buffers, joins, and selections. I am trying to delete these layers before the add-in finishes so to keep the number of layers in TOC to a minimum. Below is the piece of code I am using to delete the layers, and the error it rasiesraises.

f = ['Select_1', 'Join_1', 'Buff_1']
for x in f:
    arcpy.Delete_management(x)

Error:

Runtime error Traceback (most recent call last): File "", line 2, in File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 4359, in Delete raise e ExecuteError: ERROR 000622: Failed to execute (Delete). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_data.

Runtime error Traceback (most recent call last): File "", line 2, in File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 4359, in Delete raise e ExecuteError: ERROR 000622: Failed to execute (Delete). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_data.

Arcpy Delete Multiple Layers

I'm writing an add-in for Arcmap and at the end of it I am left with multiple layers from buffers, joins, and selections. I am trying to delete these layers before the add-in finishes so to keep the number of layers in TOC to a minimum. Below is the piece of code I am using to delete the layers, and the error it rasies.

f = ['Select_1', 'Join_1', 'Buff_1']
for x in f:
    arcpy.Delete_management(x)

Error:

Runtime error Traceback (most recent call last): File "", line 2, in File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 4359, in Delete raise e ExecuteError: ERROR 000622: Failed to execute (Delete). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_data.

Deleting Multiple Layers using ArcPy with ArcMap

I'm writing an add-in for Arcmap and at the end of it I am left with multiple layers from buffers, joins, and selections. I am trying to delete these layers before the add-in finishes so to keep the number of layers in TOC to a minimum. Below is the piece of code I am using to delete the layers, and the error it raises.

f = ['Select_1', 'Join_1', 'Buff_1']
for x in f:
    arcpy.Delete_management(x)

Error:

Runtime error Traceback (most recent call last): File "", line 2, in File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 4359, in Delete raise e ExecuteError: ERROR 000622: Failed to execute (Delete). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_data.

added 263 characters in body
Source Link

I'm writing an add-in for Arcmap and at the end of it I am left with multiple layers from buffers, joins, and selections. I am trying to delete these layers before the add-in finishes so to keep the number of layers in TOC to a minimum. Below is the piece of code I am using to delete the layers, and the error it rasies.

f = ['Select_1', 'Join_1', 'Buff_1']
for x in f:
    arcpy.Delete_management(x)

enter image description hereError:

Runtime error Traceback (most recent call last): File "", line 2, in File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 4359, in Delete raise e ExecuteError: ERROR 000622: Failed to execute (Delete). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_data.

I'm writing an add-in for Arcmap and at the end of it I am left with multiple layers from buffers, joins, and selections. I am trying to delete these layers before the add-in finishes so to keep the number of layers in TOC to a minimum. Below is the piece of code I am using to delete the layers, and the error it rasies.

f = ['Select_1', 'Join_1', 'Buff_1']
for x in f:
    arcpy.Delete_management(x)

enter image description here

I'm writing an add-in for Arcmap and at the end of it I am left with multiple layers from buffers, joins, and selections. I am trying to delete these layers before the add-in finishes so to keep the number of layers in TOC to a minimum. Below is the piece of code I am using to delete the layers, and the error it rasies.

f = ['Select_1', 'Join_1', 'Buff_1']
for x in f:
    arcpy.Delete_management(x)

Error:

Runtime error Traceback (most recent call last): File "", line 2, in File "c:\program files (x86)\arcgis\desktop10.7\arcpy\arcpy\management.py", line 4359, in Delete raise e ExecuteError: ERROR 000622: Failed to execute (Delete). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_data.

Source Link

Arcpy Delete Multiple Layers

I'm writing an add-in for Arcmap and at the end of it I am left with multiple layers from buffers, joins, and selections. I am trying to delete these layers before the add-in finishes so to keep the number of layers in TOC to a minimum. Below is the piece of code I am using to delete the layers, and the error it rasies.

f = ['Select_1', 'Join_1', 'Buff_1']
for x in f:
    arcpy.Delete_management(x)

enter image description here