From 53c796dddce18ddc3cca159103c73ddfac6fcf38 Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 3 Aug 2010 19:27:34 +0800 Subject: [PATCH] Importer: Add excetion handler to hud call. Had a report on the 2+2 thread that: File "C:\Documents and Settings\b\Desktop\fpdb\pyfpdb\GuiAutoImport.py", line 160, in do_import self.importer.runUpdated() File "C:\Documents and Settings\b\Desktop\fpdb\pyfpdb\fpdb_import.py", line 371, in runUpdated (stored, duplicates, partial, errors, ttime) = self.import_file_dict(self.database, file, self.filelist[file][0], self.filelist[file][1], None) File "C:\Documents and Settings\b\Desktop\fpdb\pyfpdb\fpdb_import.py", line 467, in import_file_dict print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud IOError: [Errno 9] Bad file descriptor Was happening, which is a crash attempting to print self.caller.pipe_to_hud This patch doesn't fix the problem, but should give some indication in the log that it happened. --- pyfpdb/fpdb_import.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index eeaa63ac..cbe87684 100755 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -464,8 +464,11 @@ class Importer: #pipe the Hands.id out to the HUD for hid in to_hud: - print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud - self.caller.pipe_to_hud.stdin.write("%s" % (hid) + os.linesep) + try: + print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud + self.caller.pipe_to_hud.stdin.write("%s" % (hid) + os.linesep) + except IOError, e: + log.error("Failed to send hand to HUD: %s" % e) errors = getattr(hhc, 'numErrors') stored = getattr(hhc, 'numHands')