ERROR

Invalid Topology [Cannot open cache file]

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

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic