title: Python daemon threads seems not work in background
body: <p>I took a piece of code from <a href="https://www.bogotobogo.com/python/Multithread/python_multithreading_Daemon_join_method_threads.php" rel="nofollow noreferrer">https://www.bogotobogo.com/python/Multithread/python_multithreading_Daemon_join_method_threads.php</a> and add three lines expecting it works a daemon that delete any file named 'Tested' . It works at start but if while runnig daemon (I guess it does it) I create a new file from command line (in GNU/linux) using 'touch test' nothing happends. I read about it but should have something that I am doing wrong if really threading daemon works in the background.</p>
  
  <pre><code>import threading
  import time
  import logging
  import os
  logging.basicConfig(level=logging.DEBUG,
                      format='(%(threadName)-9s) %(message)s',)
  
  def n():
      logging.debug('Starting')
      logging.debug('Exiting')
  
  def d():
      logging.debug('Starting')
      #  I expected these three following lines keep running in the background and delete any new file named 'Test'
  
      while True:
          if os.path.isfile('test'):
              os.remove ('test')
  
      time.sleep(5)
      logging.debug('Exiting')
  
  if __name__ == '__main__':
  
      t = threading.Thread(name='non-daemon', target=n)
      d = threading.Thread(name='daemon', target=d)
      d.setDaemon(True)
  
      d.start()
      t.start()
  </code></pre>