def on_exit(self,histfile): if self.cleanup_flag == True: self.cleanup_flag = False readline.set_history_length(self.HISTLEN) readline.write_history_file(histfile)