Delay your script so large files can finish saving

A few seconds is all you need

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s