From 2f742e371be64964fe9499824901c71f0509601c Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 28 Nov 2009 10:59:44 +0200 Subject: [PATCH] Use wider try-except block The 'temp_key' table name in hud_dict can vanish between DB roundtrips. Enclose all three lines within try-block. --- pyfpdb/HUD_main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index 39096065..4f7e8845 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -215,10 +215,10 @@ class HUD_main(object): # Update an existing HUD if temp_key in self.hud_dict: # get stats using hud's specific params and get cards - self.db_connection.init_hud_stat_vars( self.hud_dict[temp_key].hud_params['hud_days'] - , self.hud_dict[temp_key].hud_params['h_hud_days']) - stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, type, self.hud_dict[temp_key].hud_params, self.hero_ids[site_id]) try: + self.db_connection.init_hud_stat_vars( self.hud_dict[temp_key].hud_params['hud_days'] + , self.hud_dict[temp_key].hud_params['h_hud_days']) + stat_dict = self.db_connection.get_stats_from_hand(new_hand_id, type, self.hud_dict[temp_key].hud_params, self.hero_ids[site_id]) self.hud_dict[temp_key].stat_dict = stat_dict except KeyError: # HUD instance has been killed off, key is stale sys.stderr.write('hud_dict[%s] was not found\n' % temp_key)