Unfortunately my code is quite long and has some confidential information in it else I'd post it, but the gist of it is that once my script finishes, the outputs from tools I am running in my script vanish from the map document. My code looks more or less like this:
import arcpy, os# Lots of code# Set MXD and Data Frame variablesmxd = arcpy.mapping.MapDocument("CURRENT")df = arcpy.mapping.ListDataFrames(mxd)[0]for table in tableList: # More code # The below is added to keep outputs that follow from being added to the map doc arcpy.env.addOutputsToMap = False # More code # Added just before the tool whose output I want added to ArcMap arcpy.env.addOutputsToMap = True # More codemxd.save()arcpy.AddMessage("Script Finished.")My code totally works. It gets all the way to the end and correctly adds only the outputs I want and not the ones I do not. But then, AFTER it actually prints out "Script Finished," which is literally the last thing in my script, all of a sudden, the map document kind of flashes, and then one by one the tables that were added to my map document disappear.
Any ideas?
أكثر...
import arcpy, os# Lots of code# Set MXD and Data Frame variablesmxd = arcpy.mapping.MapDocument("CURRENT")df = arcpy.mapping.ListDataFrames(mxd)[0]for table in tableList: # More code # The below is added to keep outputs that follow from being added to the map doc arcpy.env.addOutputsToMap = False # More code # Added just before the tool whose output I want added to ArcMap arcpy.env.addOutputsToMap = True # More codemxd.save()arcpy.AddMessage("Script Finished.")My code totally works. It gets all the way to the end and correctly adds only the outputs I want and not the ones I do not. But then, AFTER it actually prints out "Script Finished," which is literally the last thing in my script, all of a sudden, the map document kind of flashes, and then one by one the tables that were added to my map document disappear.
Any ideas?
أكثر...