title: Python daemon shows no output for an error
body: <p>I read <a href="https://stackoverflow.com/questions/473620/how-do-you-create-a-daemon-in-python">How do you create a daemon in Python?</a> and also <a href="https://stackoverflow.com/questions/4790876">this topic</a>, and tried to write a very simple daemon :</p>
  
  <pre><code>import daemon
  import time
  with daemon.DaemonContext():
      while True:
          with open('a.txt', 'a') as f:
              f.write('Hi')
          time.sleep(2)
  </code></pre>
  
  <p>Doing <code>python script.py</code> works and returns immediately to terminal (that's the expected behaviour). But <code>a.txt</code> is never written and I don't get any error message. <strong>What's wrong with this simple <code>daemon</code>?</strong></p>