Hi All,
I am developing a script that walks a directory and sub-folders listing coverages, rasters and feature classes. Running successfully until it hits files that exist but not structured correctly / corrupted to be able to perform a describe function on.
I would like to capture these error files into a log file to check on them later, but have my script run to completition.
I have the following trying to capture error related files:
item represents path (e.g. "C:\Temp") and fileset is the file name (e.g. "data.shp").
Not sure what is happening as this seems to work elsewhere on the web I have seen referenced.
When I do a desc.SpatialReference.name will usually halt the script with the problem file.
I just need coding to detect problem spatial datasets, list them for later checking and move on.
Regards,
Craig
I am developing a script that walks a directory and sub-folders listing coverages, rasters and feature classes. Running successfully until it hits files that exist but not structured correctly / corrupted to be able to perform a describe function on.
I would like to capture these error files into a log file to check on them later, but have my script run to completition.
I have the following trying to capture error related files:
Code:
try:
<my code>
except arcpy.ExecuteError:
arcpy.AddError(arcpy.GetMessage(2))
f=open(r'D:\Temp\error.log', 'a')
f.write(item + "\\" + fileset)
f.close()
Not sure what is happening as this seems to work elsewhere on the web I have seen referenced.
When I do a desc.SpatialReference.name will usually halt the script with the problem file.
I just need coding to detect problem spatial datasets, list them for later checking and move on.
Regards,
Craig