title: Python Popen not working on Windows with time.sleep
body: <p>I am trying to use the below code sample to check if a schema file exists, if it does not I start a thread to use Popen to download a new schema file while opening up a second window "Downloading new schema file. Please wait.". Using time.sleep(0.5) to wait for the file to download before closing the second window. This all works fine on Mac OSX, but in windows it opens up the second window "Downloading new schema file. Please wait." but then just freezes without downloading the schema file, I then need to crash it out.
  As this works on Mac, what can I do to make this work on both OS's please?</p>
  
  <pre><code>def schemaVersionCheck(self, Version):
      foundSchemaFile = False
      for rngFile in os.listdir("."):
          if rngFile.endswith(".rng"):
              foundSchemaFile = True
              if rngFile != self.schemaFile:
                  foundSchemaFile = False
  
      if foundSchemaFile == False:
          threading.Thread(target=self.getNewSchema, args=(Version, )).start()
          msg = "Downloading new schema file. Please wait."
          self.busyDlg = wx.BusyInfo(msg)
          while not os.path.exists(self.schemaFile):
              time.sleep(0.5)
          self.busyDlg = None
  
  def getNewSchema(self, Version):
      schemaType = "transitional"
      self.schemaFile = Version + "-" + schemaType + ".rng"
      command = '%s -m generateSchema -u %s -p %s -schema %s -schemaType %s -s shortname -destination .' % (self.params["Link"], self.params["Username"], self.params["Password"], Version, schemaType)
      if self.params["systemType"] == "Windows":
          command = command + " -WONoPause true"
          startupinfo = subprocess.STARTUPINFO()
          startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
          p = Popen(command, startupinfo=startupinfo, shell=False, stdout=PIPE, stderr=PIPE, stdin=PIPE)
      else:
          p = Popen(shlex.split(command), shell=False, stdout=PIPE, stderr=PIPE, stdin=PIPE)
  </code></pre>