ERROR
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)
The error is returned if the machine running ArcMap has insufficient memory to run the Dissove_management() tool.
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
Get help from ArcGIS experts
Start chatting now