Skip to content

Commit 9858c9c

Browse files
Update front_panel_settings.py
Fixed try-except logic to be purely conditional to handle 'connection table' object not existing in apparatus settings h5 file
1 parent 118ed1b commit 9858c9c

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

blacs/front_panel_settings.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ def setup(self,blacs):
4747

4848
def restore(self):
4949

50-
# See if connection table exists in apparatus h5 file
51-
# Return if not
52-
#
5350
# Get list of DO/AO
5451
# Does the object have a name?
5552
# yes: Then, find the device in the BLACS connection table that matches that name
@@ -72,16 +69,16 @@ def restore(self):
7269
question = {}
7370
error = {}
7471
tab_data = {'BLACS settings':{}}
75-
try:
76-
with h5py.File(settings_path,'r') as h5file:
77-
if 'connection table' in h5file:
78-
logger.info('Settings connection table found in file')
79-
except:
80-
logger.info('connection table not in file yet')
81-
return settings,question,error,tab_data
8272

83-
try:
73+
# See if connection table exists in apparatus h5 file
74+
with h5py.File(self.settings_path, 'r') as h5file:
75+
if 'connection table' not in h5file:
76+
logger.info('Front panel settings connection table not found!')
8477

78+
# TODO: tab_data will be passed into restore_window next, populate this
79+
return settings, question, error, tab_data
80+
81+
try:
8582
saved_ct = ConnectionTable(self.settings_path, logging_prefix='BLACS', exceptions_in_thread=True)
8683
ct_match,error = self.connection_table.compare_to(saved_ct)
8784

0 commit comments

Comments
 (0)