Spaces:
Sleeping
Sleeping
| import os | |
| import json | |
| import sys | |
| # Mocking the location of data_service.py | |
| # We are currently in /backend | |
| # data_service is in /backend/app/services/data_service.py | |
| # So we need to simulate that path structure to test relative path logic | |
| # Let's define the path logic exactly as in data_service.py | |
| # We can use a dummy file as the anchor | |
| dummy_file = os.path.join(os.getcwd(), "app/services/data_service.py") | |
| print(f"Simulating __file__ as: {dummy_file}") | |
| norms_path = os.path.join( | |
| os.path.dirname(os.path.dirname(dummy_file)), "data/norms.json" | |
| ) | |
| print(f"Resolved norms path: {norms_path}") | |
| if os.path.exists(norms_path): | |
| print("β File found!") | |
| try: | |
| with open(norms_path, "r") as f: | |
| data = json.load(f) | |
| print(f"β Loaded {len(data)} items.") | |
| print("First item keys:", data[0].keys()) | |
| except Exception as e: | |
| print(f"β JSON Load Error: {e}") | |
| else: | |
| print("β File NOT found at resolved path.") | |
| # Debug listing | |
| parent = os.path.dirname(norms_path) | |
| print(f"Listing parent dir: {parent}") | |
| if os.path.exists(parent): | |
| print(os.listdir(parent)) | |
| else: | |
| print("Parent dir does not exist.") | |