Doing an intersection and some files already exist.Is it possible to tackle this error specifically and not with try except in general?
try:
for i in cur:
Intersect_analysis (in_features, out_feature_class)
except arcpy.ExecuteError as e:
print(e)
pass
file already exists.
This may pass any execute error instead of just this with a file being already there.
OR
Since the above error stopped the whole program and now has to restart,
another plan would be to search in the gdb
which feature layers aren't there and proceed to do the intersect only to the new ones that haven't been processed due to the program stop.
1 Answer 1
You can tell arcpy to overwrite any outputs if you wish:
The following should do the trick:
>>> from arcpy import env
>>> env.overwriteOutput = True
-
2Yeah although this wouldn't cause error it would double the processing.user51332– user513322018年11月09日 06:59:20 +00:00Commented Nov 9, 2018 at 6:59
if not arcpy.Exists(out_feature_class):