Using ArcPy in PyCharm, I'm constantly getting Process finished with exit code -1073741819 (0xC0000005) in my RegionGroup loop. I have posted my code in a previous question (Process finished with exit code -1073741819 (0xC0000005) from RegionGroup (ArcGIS 10.7)).
Here I want to know if there is a general possibility to catch a system exit like this (by transforming it into a "real" python error maybe), skip the current iteration and start the next.
I've looked at Catching a system exit with GDAL Python but this seemed to have been due to a GDAL-related bug.
EDIT:
I've tried catching the error using try and except, but so far that has not worked.
try:
regionGrp = RegionGroup(sinks)
# or to avoid saving in a tmp file with potential access violations:
region_save = "C:/.../regionGrp{}.tif".format(glacierID)
RegionGroup(sinks).save(region_save)
except:
print "== strange system exit caught =="
break
The result in the terminal (if the loop breaks) is:
Connecting regions
Compacting labels
Process finished with exit code -1073741819 (0xC0000005)
Normally it should go on like this:
Connecting regions
Compacting labels
Building Attributes
Updating link item
Maybe the error cannot be caught because it happens in the middle of this multi-step RegionGroup algorithm? I'm fairly new to python so I'm not sure if this could be a possibility.
except SystemExitorexcept arcpy.ExecuteError? I cannot reproduce your error so I cannot test it but let me know if it works. – Marcelo Villa Jan 23 '20 at 17:39RegionGroup, but mostly doesn't. I've tried following your advice doingtry : RegionGroup(sinks) except SystemExit: print "skip iteration"but that does not seem to have any effect. – Florian Mlehliv Jan 23 '20 at 19:40arcpy.ExecuteError... – Florian Mlehliv Jan 23 '20 at 19:41