ERROR

Invalid Topology [Cannot open cache file]

Last Published: April 25, 2020

Error Message

Attempts to run the Dissolve tool using a Python script fail and return the following error:

Error:
Invalid Topology [Cannot open cache file]

The following is an example of the code snippet:

logging.info("Merging layers")
arcpy.Merge_management(layersForMerge, mergeFC)
logging.info("Buffering merged feature class")
arcpy.Buffer_analysis(mergeFC, bufferFC, "30 Meters", "FULL", "ROUND", "NONE", "", "PLANAR")
logging.info("Dissolving buffer feature class (this may take a while)...")
arcpy.Dissolve_management(bufferFC, dissolvedFC, "", "", "MULTI_PART", "DISSOLVE_LINES")
arcpy.Delete_management(bufferFC)

Cause

The error is returned if the machine running ArcMap has insufficient memory to run the Dissove_management() tool.

Solution or Workaround

To prevent the error, clear the memory for the Dissolve tool. This can be done by deleting the previous processes taking up memory space using the Delete_management() function, and adding the garbage collection Python function, gc.collect(), to free the memory. The following is an example of the code snippet used to do this:

logging.info("Merging layers")
arcpy.Merge_management(layersForMerge, mergeFC)
logging.info("Buffering merged feature class")
arcpy.Buffer_analysis(mergeFC, bufferFC, "30 Meters", "FULL", "ROUND", "NONE", "", "PLANAR")
logging.info("Dissolving buffer feature class (this may take a while)...")

arcpy.Delete_management(mergeFC)
gc.collect()
arcpy.Dissolve_management(bufferFC, dissolvedFC, "", "", "MULTI_PART", "DISSOLVE_LINES")
arcpy.Delete_management(bufferFC)

 

Article ID:000017144

Software:
  • ArcMap

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options