def __init__(self, logPath, mainWindow):
super().__init__(logPath, mainWindow)
self.log = open(logPath, 'r', encoding="utf8")
self.log.readline()
self.log.readline()
characterLine = self.log.readline()
character = re.search("(?<=Listener: ).*", characterLine)
if character:
character = character.group(0)
else:
raise BadLogException("not character log")
self.log.readline()
self.log.readline()
self.logLine = self.log.readline()
if (self.logLine == "------------------------------------------------------------\n"):
self.log.readline()
collisionCharacter = re.search("(?<=Listener: ).*", self.log.readline()).group(0)
messagebox.showerror("Error", "Log file collision on characters:\n\n" + character + " and " + collisionCharacter +
"\n\nThis happens when both characters log in at exactly the same second.\n" +
"This makes it impossible to know which character owns which log.\n\n" +
"Please restart the client of the character you want to track to use this program.\n" +
"If you already did, you can ignore this message, or delete this log file:\n" + logPath)
raise BadLogException("log file collision")
self.log.read()
评论列表
文章目录