title: Python wait and check if file is created completely by external program
body: <p>I currently have external program outputting in the file in directory 'DIR'. Now if I want to see from python if the file is created completely, how can I check that and if done execute program. </p>
  
  <p>My research indicate that it could be done via </p>
  
  <pre><code>os.path.isfile(FILE_NAME)
  </code></pre>
  
  <p>but how do I keep on checking, in a way it does not mess-up other program. Here is something I had an idea about ? Please let me know how this can be achieved ? or is my template good enough ? </p>
  
  <pre><code>counter = 0;
  
  While os.path.isfile(FILE_NAME) == False:
   Time.Sleep(3)
   counter += 1
  
  if counter &lt; 5:
     # I guess we are good at this point ?
  </code></pre>
  
  <p>Thank you for your time and consideration. </p>