I have a function outputTblContents which contains
def outputTblContents ( path ): rows = arcpy.SearchCursor(path, fields="alpha; beta") for row in rows: print("{0} => {1}").format(row.getValue("alpha"), row.getValue("beta")) The function that called outputTblContents then tries to delete the folder that path is in, but is unable to because it’s still in use by the script. I guess arcpy.SearchCursor spawns it’s own thread. How do I wait for it to be finished so I can safely delete the shapefiles and clean up?
outputTblContents(pathToShpfile) shutil.rmtree(pathToTempDir) Here is the error WindowsError: [Error 32] The process cannot access the file because it is being used by another process: '\\\\storage1\\gis\\dev\\temp\\ collated_a1.shp….sr.lock'
أكثر...
def outputTblContents ( path ): rows = arcpy.SearchCursor(path, fields="alpha; beta") for row in rows: print("{0} => {1}").format(row.getValue("alpha"), row.getValue("beta")) The function that called outputTblContents then tries to delete the folder that path is in, but is unable to because it’s still in use by the script. I guess arcpy.SearchCursor spawns it’s own thread. How do I wait for it to be finished so I can safely delete the shapefiles and clean up?
outputTblContents(pathToShpfile) shutil.rmtree(pathToTempDir) Here is the error WindowsError: [Error 32] The process cannot access the file because it is being used by another process: '\\\\storage1\\gis\\dev\\temp\\ collated_a1.shp….sr.lock'
أكثر...