title: Python writing to text-file does not work sometimes
body: <p>I have a function that writes log-texts into a text-file:</p>
  
  <pre><code>from time import strftime, localtime
  
  def log(Text):
      with open("Log.txt", 'a') as log_file:
          log_file.write(strftime('%H:%M:%S',localtime()) + ' -- ' + Text + '\n')
  </code></pre>
  
  <p>On the first run, when Log.txt is not yet created, this code works: it creates a file with called 'Log.txt' and when I open it I can see the text that I gave as input.</p>
  
  <p>After that however it doesn't work anymore. When this file exists and I give a new text as input to write to it, it does not do that. I also checked the time of last modification of the file itself: the code doesn't even touch the text-file, since the modicification time remains the same.</p>
  
  <p>I hope someone shows what's wrong here.</p>
  
  <p>Regards, Ganesh</p>