From 68e20f54eda6de055adb9bda5969bedf20cf928b Mon Sep 17 00:00:00 2001 From: binary Date: Sun, 14 Feb 2021 12:01:27 +0100 Subject: Load empty structure on empty yaml input file. Previously, python used to create an NoneType object when loading an empty yaml input file. --- dynamic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dynamic.py b/dynamic.py index 4b5cde5..908e4d3 100755 --- a/dynamic.py +++ b/dynamic.py @@ -35,7 +35,7 @@ class AnsibleInput: def __init__(self, filepath): with open(filepath) as file: - self.data = yaml.load(file, Loader=yaml.FullLoader) + self.data = yaml.load(file, Loader=yaml.FullLoader) or {} self.name = os.path.splitext(os.path.basename(filepath))[0] -- cgit v1.2.3