We’ve been running a few standalone Python scripts using ArcGIS Pro 3.2.0 that execute every 10 to 30 minutes. The process calls a .pyt file, which reads a points dataset and runs the Spatial Analyst IDW tool to create interpolated outputs for rainfall, snow, temperature, and other variables. The output is logged into text files for monitoring purposes.
Typically, everything runs smoothly, and each execution writes a log message indicating success. However, every once in a while—usually once a week or month—the IDW process seems to cause the entire Python process to crash. When this happens, no log message is written, and the crash goes unnoticed unless we manually check the process.
Here’s the typical python workflow:
try:
logger.log_event(messages, "IDW Process Running...")
snowTotIDW = Idw(out_snow_copy, interpolateField, cellSize, power, searchRadius)
logger.log_event(messages, "Completed")
except arcpy.ExecuteError as arcpy_error:
logger.log_event(messages, f"Execute Error:{arcpy_error}\nMessages: {arcpy.GetMessages(2)}")
run_process = False
raise
except Exception as e:
logger.log_event(messages, f"Exception: {e}")
logger.log_event(messages, "ERROR")
raise
The problem is intermittent, but when it happens, it’s a real pain as there’s no direct error message, and no log is produced. This leaves us in the dark about what happened. The only way we can tell is by the time difference in the logfile as shown below where the IDW proces started and then no logs are written out until the process starts again 30mins later:
Is there a better or more robust way to perform this operation using ArcGIS Pro’s tools, or is this just something that can happen once in a blue moon?
Can using atexit help?
I’ve considered using Python’s atexit.register(cleanup) method to register a cleanup function that would catch crashes or unexpected terminations. This could potentially help log any issues and clean up resources, but I’m unsure if it would be sufficient to catch this specific type of crash that happens within the IDW process.
I’d love to hear from others who may have encountered similar issues with ArcGIS Pro 3.2.0 or IDW crashes in general. Any advice or alternative approaches to making this process more reliable would be much appreciated.
If IDW fails, it may have something to do with the data itself. To rule this out I would do the following outside of any try-except block so that the information on the inputs is collected.
when a run fails, at least you can look at the inputs just prior to any try-except block logging
PS
I am assuming you can rule out
The same issue finally arose after implementing the collection of inputs prior to the IDW tool running. Unfortunately, these input results were the same as shown in the screenshot below, meaning there were no obvious differences in the extent, cell size, number of points, or value ranges when the crash occurred. This suggests the failure is not due to variations in the input data itself.
Green tick for successful pass
"intermittent" crashes are probably the hardest to track down. If it happens just after a project clean start, then you might have something to forward on to Tech Support to assess.
Save Project... prior to a run of IDW is all I could suggest now.
Good Luck
Thank you!
I'll add this information to the logs for if/when this situation occurs again.
And yes I too think I can rule out that bug report.
My guess is that the script is crashing at some point. I would catch and print the traceback error to the log file for additional info. Here is an example.