From ed2a5f575e4abf674d5f770e772011cc6d8b5886 Mon Sep 17 00:00:00 2001 From: tischrei Date: Wed, 13 Aug 2025 13:15:37 +0000 Subject: [PATCH] fix file_path (#45) Reviewed-on: https://gitea.eco.tsi-dev.otc-service.com/infra/otc-metadata-rework/pulls/45 Reviewed-by: Gode, Sebastian Co-authored-by: tischrei Co-committed-by: tischrei --- otc_metadata/analytics/data.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/otc_metadata/analytics/data.py b/otc_metadata/analytics/data.py index 131f6ff..0424b3b 100644 --- a/otc_metadata/analytics/data.py +++ b/otc_metadata/analytics/data.py @@ -14,7 +14,8 @@ from pathlib import Path import json -analytics_path = Path("otc_metadata/analytics/public") +BASE_DIR = Path(__file__).resolve().parent +analytics_path = BASE_DIR / "public" cloud_environments = [ 'eu_de', @@ -24,8 +25,8 @@ analytics_data = {k: [] for k in cloud_environments} # Open and read the json data files for env in cloud_environments: - file_path = analytics_path.joinpath(f"{env}.json") - with open(file_path, 'r') as file: + file_path = analytics_path / f"{env}.json" + with file_path.open(encoding="utf-8") as file: analytics_data[env] = json.load(file)