From ad7096550b8a8cdede3c1191cdde4169d865ef0f Mon Sep 17 00:00:00 2001 From: David Huard Date: Thu, 14 Dec 2023 17:02:51 -0500 Subject: [PATCH] Read YML file with encoding for validation --- xclim/core/indicator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xclim/core/indicator.py b/xclim/core/indicator.py index df1d68b3c..6590ab9a4 100644 --- a/xclim/core/indicator.py +++ b/xclim/core/indicator.py @@ -1721,7 +1721,9 @@ def build_indicator_module_from_yaml( # noqa: C901 schema = yamale.make_schema(Path(__file__).parent.parent / "data" / "schema.yml") # Validate - a YamaleError will be raised if the module does not comply with the schema. - yamale.validate(schema, yamale.make_data(ymlpath)) + yamale.validate( + schema, yamale.make_data(content=ymlpath.read_text(encoding=encoding)) + ) # Load values from top-level in yml. # Priority of arguments differ.