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.
This commit is contained in:
Worros 2010-08-03 19:27:34 +08:00
parent 9329475298
commit 53c796dddc

View File

@ -464,8 +464,11 @@ class Importer:
#pipe the Hands.id out to the HUD #pipe the Hands.id out to the HUD
for hid in to_hud: for hid in to_hud:
try:
print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_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) 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') errors = getattr(hhc, 'numErrors')
stored = getattr(hhc, 'numHands') stored = getattr(hhc, 'numHands')