title: Python: Write Logfile
body: <p>I created an own class to open and write a linefile:</p>
  
  <pre><code>import os, datetime
  
  class LogFile:
  
      def __init__(self, FileName):
          FilePath = "C:/MyDirectory/Log"
          self.__FileName = FileName
          self.__FullFileName = FilePath + "/" + self.__FileName
          if os.path.exists(self.__FullFileName):
              os.remove(self.__FullFileName)
          self.__File = open(self.__FullFileName,'a')
      def __del__(self):
          pass
      def openFile(self):        
          now = datetime.datetime.now()
          time = now.strftime("%Y-%m-%d %H:%M")
          self.__File.write(time + '/n')        
      def closeFile(self):
          self.__File.close
      def writeFile(self,Text):
          self.__File.write(Text)
  </code></pre>
  
  <p>It displays no error, opens the file, but does not write a line in my new file:    </p>
  
  <pre><code>&gt;&gt;&gt; import log
  &gt;&gt;&gt; from log import LogFile
  &gt;&gt;&gt; aa = LogFile("newbie")
  &gt;&gt;&gt; aa.openFile()
  &gt;&gt;&gt; aa.writeFile("newtext")
  </code></pre>
  
  <p>Thanks for any help.</p>