diff --git a/openap/drag.py b/openap/drag.py index dcfe0f0d..8821fafb 100644 --- a/openap/drag.py +++ b/openap/drag.py @@ -65,7 +65,8 @@ def dragpolar(self): raise RuntimeError(f"Drag polar for {self.ac} not avaiable in OpenAP.") f = dir_dragpolar + ac + ".yml" - dragpolar = yaml.safe_load(open(f)) + with open(f, "r") as file: + dragpolar = yaml.safe_load(file.read()) return dragpolar @ndarrayconvert diff --git a/openap/prop.py b/openap/prop.py index 45a61c2f..a466db39 100644 --- a/openap/prop.py +++ b/openap/prop.py @@ -56,7 +56,8 @@ def aircraft(ac, use_synonym=False, **kwargs): raise RuntimeError(f"Aircraft {ac} not avaiable in OpenAP.") f = files[0] - acdict = yaml.safe_load(open(f)) + with open(f, "r") as file: + acdict = yaml.safe_load(file.read()) return acdict