From fe8989ae84b8f3472dc11af1367db53611c78792 Mon Sep 17 00:00:00 2001 From: Eevee Date: Tue, 2 Feb 2010 21:24:21 -0800 Subject: [PATCH] Fixed NetHack plugin crashing on first load. --- plugins/NetHack/plugin.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/NetHack/plugin.py b/plugins/NetHack/plugin.py index 6560f80..05d78db 100644 --- a/plugins/NetHack/plugin.py +++ b/plugins/NetHack/plugin.py @@ -119,7 +119,7 @@ def parse_livelog(line): data[key] = val return data - + def livelog_announcement(livelog): # achievement gained if 'achieve_diff' in livelog: @@ -181,8 +181,12 @@ class NetHack(callbacks.Plugin): self.xlog.seek(0, os.SEEK_END) self.livelog.seek(0, os.SEEK_END) - # Remove the event first, in case this is a reload - schedule.removePeriodicEvent('nethack-log-ping') + # Remove the event first, in case this is a reload. This will fail if + # this is the first load, so throw it in a try + try: + schedule.removePeriodicEvent('nethack-log-ping') + except: + pass def callback(): self._checkLogs(irc) -- 2.7.4