0

I am using ArcGIS Desktop 10.2.

I have a script that successfully converts a .csv into an already-existing feature class by first truncating the feature class table and then using the following line to replenish the table with the new data from the first parameter, "source" (an XYEventLayer).

arcpy.Append_management(input, target, "NO_TEST", mapping)

The destination feature class ("target") already exists in the TOC, within two group layers.

But every time I run the script a new duplicate layer appears at the top of the Table of Contents. I'm 99% sure this is being done by the Append_management tool although ESRI's documentation doesn't mention this behavior.

How can I prevent the Append_management tool from adding its output ("target") to the TOC?

marked as duplicate by PolyGeo arcpy Oct 2 '18 at 2:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Perhaps try following the examples from this post: Prevent newly created feature class being automatically added by ArcPy (Python AddIn) to Map Document?

The approved answer here offers two choices:

1) Open the Geoprocessing Options, and turn off the "Add results of geoprocessing operations to the display" option.

The second option is to add a line to your code with prevents the outputs of the Geoprocessing Tool from being added to the map.

This can be done by adding to the lines above the running the Append function:

arcpy.env.addOutputsToMap = 0

This is detailed here: http://resources.arcgis.com/en/help/main/10.2/index.html#//018z0000004s000000

I think you can also use (although its the same as above):

arcpy.env.addOutputsToMap = False

Not the answer you're looking for? Browse other questions tagged or ask your own question.