Commits

lhonda  committed c0e00b5

changed KEYWORD to comofas

  • Participants
  • Parent commits 53eee52

Comments (0)

Files changed (2)

         logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG,)
 
         if PICKLE_FILENAME in os.listdir('.'):
-            self.picklefd = open(PICKLE_FILENAME)
+            self.picklefd = open(PICKLE_FILENAME,"rb")
             try:
                 self.last_feeds = pickle.load(self.picklefd)
             except EOFError:
                 self.last_feeds = dict()
+            finally:
+                self.picklefd.close()
         else:
             self.picklefd =open(PICKLE_FILENAME,'wb')
             pickle.dump(self.last_feeds,self.picklefd)
             self.picklefd.close()
             self.picklefd =open(PICKLE_FILENAME,'wb')
             self.last_feeds = pickle.load(self.picklefd)
+            self.picklefd.close()
 
     def get_last_feed(self):
         """
                             logging.debug("Nao entendi:" + pergunta)
                             self.nao_entendi(usuario)
         except KeyboardInterrupt:
-            # TODO: testar como faz o pickle gravar direito o self.last_feeds
+            self.picklefd =open(PICKLE_FILENAME,"wb")
             pickle.dump(self.last_feeds,self.picklefd)
             self.picklefd.close()
             sys.exit(1)

File comofas_settings.py

 REGION='br'
-KEYWORD='pythontest'
+KEYWORD='comofas'
 
 LOG_FILENAME='logging.out'