mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 09:52:27 -04:00
Improve the behaviour of yamlget.py when run with python2
This commit is contained in:
parent
0ec77c2b92
commit
9e72266705
1 changed files with 8 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue