title: How to handle windows "Drive not ready", "No disc" etc alert dialog
body: <p>Am trying to avoid windows alert showing 'drive not ready' or 'no disc' when running my application. Here is what i have fsp.py</p>
  
  <pre><code>import os, win32api
  oer = win32api.SetErrorMode( 1 ) #note that SEM_FAILCRITICALERRORS = 1
  def check(drive):
      try:
          with open(drive+'\\fsp.check', 'w') as drive_check:
              drive_check.write('000')
          os.unlink(drive+'\\fsp.check')
          return True
      except Exception, e:
          win32api.SetErrorMode(oer)
          return False
  </code></pre>
  
  <p>And mount.py to tell mounted devices.</p>
  
  <pre><code>import os
  def Query(letters):
  #Get mounted devices
      try:
          for l in letters:
              l = l+':\\'
              if os.path.isdir(l):
                  yield l
      except Exception, queryex:
          pass
          #print str(queryex)
  def main():   
      try:
          return Query(('abefghijklmnopqrstuvwxyz').upper())
      except Exception, mainex:
          pass
          #print str(mainex)        
  if __name__ == '__main__':
  main()
  </code></pre>
  
  <p>Here is how am trying to use both modules. example.py</p>
  
  <pre><code>import mount, fsp
  for a in mount.main():
      if fsp.check(a) == True:
          print 'Monted and Ready ', a
      else:
          print 'Mounted but not ready ',a
  </code></pre>
  
  <p>but i still get windows alert. HOW TO AVOID IT. at least by using fsp.py code.</p>