From: Mark Andrews Date: Thu, 4 Jun 2020 22:43:17 +0000 (+1000) Subject: Improve the behaviour of yamlget.py when run with python2 X-Git-Tag: v9.17.2~14^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e72266705f643bed4a53ec94cf1e4ae53f66b22;p=thirdparty%2Fbind9.git Improve the behaviour of yamlget.py when run with python2 --- diff --git a/bin/tests/system/digdelv/yamlget.py b/bin/tests/system/digdelv/yamlget.py index 5e35c5658aa..77ac0f04a36 100644 --- a/bin/tests/system/digdelv/yamlget.py +++ b/bin/tests/system/digdelv/yamlget.py @@ -13,7 +13,9 @@ import sys try: import yaml -except (ModuleNotFoundError, ImportError): +# flake8: noqa: E722 +# pylint: disable=bare-except +except: print("No python yaml module, skipping") sys.exit(1) @@ -25,6 +27,10 @@ with open(sys.argv[1], "r") as f: except ValueError: pass - item = item[key] + try: + item = item[key] + except KeyError: + print('Key "' + key + '" not found.') + sys.exit(1) print(item)