Skip to content

Commit 27abd68

Browse files
committed
Fixup templates_configuration
1 parent b69926f commit 27abd68

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/ert/storage/local_experiment.py

+12-13
Original file line numberDiff line numberDiff line change
@@ -272,24 +272,23 @@ def parameter_info(self) -> dict[str, Any]:
272272

273273
@property
274274
def templates_configuration(self) -> list[tuple[str, str]]:
275+
templates: list[tuple[str, str]] = []
275276
try:
276-
templates: list[tuple[str, str]] = []
277277
with open(self.mount_point / self._templates_file, encoding="utf-8") as f:
278278
templates = json.load(f)
279-
templates_with_content: list[tuple[str, str]] = []
280-
for source_file, target_file in templates:
281-
try:
282-
file_content = (self.mount_point / source_file).read_text("utf-8")
283-
templates_with_content.append((file_content, target_file))
284-
except UnicodeDecodeError as e:
285-
raise ValueError(
286-
f"Unsupported non UTF-8 character found in file: {source_file}"
287-
) from e
288-
return templates_with_content
289279
except (FileNotFoundError, json.JSONDecodeError):
290-
pass
291280
# If the file is missing or broken, we return an empty list
292-
return []
281+
pass
282+
templates_with_content: list[tuple[str, str]] = []
283+
for source_file, target_file in templates:
284+
try:
285+
file_content = (self.mount_point / source_file).read_text("utf-8")
286+
templates_with_content.append((file_content, target_file))
287+
except UnicodeDecodeError as e:
288+
raise ValueError(
289+
f"Unsupported non UTF-8 character found in file: {source_file}"
290+
) from e
291+
return templates_with_content
293292

294293
@property
295294
def response_info(self) -> dict[str, Any]:

0 commit comments

Comments
 (0)