From b4890d1050dc927c9c742660d05da27b5edb9aa0 Mon Sep 17 00:00:00 2001 From: Tomasz Bold <tomasz.bold@gmail.com> Date: Fri, 15 Nov 2019 07:25:31 +0000 Subject: [PATCH] protected confTool from contant that is not actual configuration --- Control/AthenaConfiguration/share/confTool.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Control/AthenaConfiguration/share/confTool.py b/Control/AthenaConfiguration/share/confTool.py index e2fbb1c9909..e061d0ae333 100755 --- a/Control/AthenaConfiguration/share/confTool.py +++ b/Control/AthenaConfiguration/share/confTool.py @@ -54,8 +54,12 @@ def __print( fname ): print ("... ", fname, "content") for n,c in enumerate(conf): print ("Item", n, "*"*80) - pprint.pprint(dict(c)) - print ("... EOF", fname) + try: + pprint.pprint(dict(c)) + except: + print("This item is not a dictionary" ) + print( c ) + print ("... EOF", fname) def __printComps( fname ): conf = __loadSingleFile( fname ) @@ -89,7 +93,14 @@ def __printComps( fname ): def __diff(): def __merge( c ): confdict = {} - [ confdict.update( el ) for el in c ] + def __updateIfDict( data ): + emptyDict = {} + try: + confdict.update(data) + except: + pass + + [ __updateIfDict( el ) for el in c if el ] return confdict confs = [ __merge( __loadSingleFile( f )) for f in args.file ] -- GitLab