I ran into an interesting issue the other day while updating some old ArcMap MXD files. The ArcPy script I wrote worked great except for the last file it processed would get corrupted and not open. I pondered for a bit and spoke with my friend who suggested that the script was ending while the last file was saving and thus corrupting the output since the process did not get to finish properly. I added a delay at the end of the process allowing everything to finish up before the script ends. And…it worked!
Getting a script to sit and do nothing may seem counter-intuitive, but sometimes it’s exactly what needs to happen. Here’s how to make a python script wait 6 seconds.
import time time.sleep(6)