Came across this post and I'm having the same issue as Richard Watson. I have a Python Toolbox that can create a graph fine on the first try, but subsequent runs of the tool results in an error. Closing ArcMap deletes the temporary graph & the tool will run correctly once, but I'm unable to delete the temporary graph using Arcpy. Has anyone found a solution? I've tried several approaches to delete the temp graph file with no luck. def execute(self, parameters, messages): # Attempt to setup Current Workspace folder = parameters[0].valueAsText arcpy.env.workspace = folder referenceFiles = os.path.join(os.path.dirname(__file__), "Reference Files - Please don't alter\This Tool" graph_Template = os.path.join(referenceFiles, "ownership.grf") (1st approach) if arcpy.Exists("temp_graph"): arcpy.Delete_management("temp_graph") arcpy.MakeGraph_management(graph_Template, [...], "temp_graph") arcpy.SaveGraph_management("temp_graph", [...] else: arcpy.MakeGraph_management(graph_Template, [...], "temp_graph") arcpy.SaveGraph_management("temp_graph", [...]) (2nd approach) arcpy.MakeGraph_management(graph_Template, [...], "temp_graph") arcpy.SaveGraph_management("temp_graph", [...]) arcpy.Delete_management("in_memory") Here's my question posted on stack exchange: arcgis 10.4 - How do you delete temporary graph files using Arcpy? - Geographic Information Systems Stack Exchange
... View more