commit 2fe6da136e5c577d8197e2d0846017f5e4adc390
parent 698aaa21c4ca3bef91219baefbffc99bcfa0bdf6
Author: Antoine Amarilli <ant.amarilli@free.fr>
Date: Sat, 21 May 2011 02:34:05 -0400
save on any exception, not just KeyboardInterrupt
Diffstat:
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/snipe.py b/snipe.py
@@ -158,7 +158,7 @@ try:
except UnicodeDecodeError:
line = l.decode('latin1')
if (not line):
- break
+ raise ValueError
chan, speaker, message, to_us = parse(line)
if speaker not in list(game.keys()):
game[speaker] = Player(speaker)
@@ -207,10 +207,10 @@ try:
for player in set([t[0] for t in todo]):
game[player].report()
-except KeyboardInterrupt:
- pass
+except Exception as e:
+ f = open(dump_file, 'wb+')
+ pickle.dump(game, f)
+ f.close()
+ raise e
-f = open(dump_file, 'wb+')
-pickle.dump(game, f)
-f.close()