title: Password protect a file in python
body: <p><strong>WHAT:</strong></p>
  
  <p>Is there any way to create a password protected file, to prevent unauthorised writing, in python3? The main focus is on writing, not necessarily on reading. </p>
  
  <p>This file should be appendable, by the python program, given the correct password.</p>
  
  <p>The solution should not be OS specific.</p>
  
  <p><strong>WHY:</strong></p>
  
  <p>My server needs to log message details and write them to a file, in order to mitigate repudiation attacks. The file obviously has to be write protected or else this purpose is defeated.</p>
  
  <p><strong>HOW:</strong></p>
  
  <p>Any ideas?</p>
  
  <p><strong>Note:</strong></p>
  
  <p>I've looked at putting the files in a protected zip folder with pyminizip and locking file permissions with os.chmod commands. However, I've found none of these solutions to work for me. </p>