def thread(nick, channels): irc = IrcServer(nick) irc.autojoin = channels while True: try: irc.loop() break except Exception as e: type, value, tb = sys.exc_info() print(nick + " ===============") traceback.print_tb(tb) print(repr(e)) print(nick + " ===============") irc.disconnect()