def run_bot(): from handler import Bot while True: try: # initialize and run botko = Bot() botko.run() except Exception: # log the error from traceback import format_exc from datetime import datetime from time import sleep print("ERR " + str(format_exc())) f = open('error_log', 'a') f.write(str(datetime.now()) + "\n") f.write(str(format_exc() + "\n\n")) f.close() sleep(10)
def run_bot(): import settings from handler import Bot while True: try: # initialize botko = Bot() # and run botko.run(settings.IRC_SERVER, settings.IRC_PORT) except Exception as e: # log the error from traceback import format_exc from datetime import datetime from time import sleep f = open("error_log", "a") f.write(str(datetime.now()) + "\n") f.write(str(format_exc() + "\n\n")) f.close() sleep(10)
def run_bot(): import settings from handler import Bot while True: try: # initialize botko = Bot() # and run botko.run(settings.IRC_SERVER, settings.IRC_PORT) except Exception as e: # log the error from traceback import format_exc from datetime import datetime from time import sleep print "ERR " + str(format_exc()) f = open('error_log', 'a') f.write(str(datetime.now()) + "\n") f.write(str(format_exc() + "\n\n")) f.close() sleep(10)
def setUp(self): self.bot = Bot() self.logic = BotLogic(self.bot)
@author: smotko ''' from traceback import format_exc from datetime import datetime from time import sleep from settings import * if __name__ == '__main__': from handler import Bot while True: try: # initialize botko = Bot() # and run botko.run(IRC_SERVER, IRC_PORT) except Exception as e: # ugly code to restart the bot on error f = open('error_log', 'a') f.write(str(datetime.now()) + "\n") f.write(str(format_exc() + "\n\n")) f.close() sleep(1)