Spaces:
Runtime error
Runtime error
Create check_json.py
Browse files- check_json.py +15 -0
check_json.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
|
| 4 |
+
JSON_FILE = "articles.json"
|
| 5 |
+
|
| 6 |
+
print("WORKDIR:", os.getcwd())
|
| 7 |
+
print("Files:", os.listdir("."))
|
| 8 |
+
print("Exists articles.json?", os.path.exists(JSON_FILE))
|
| 9 |
+
|
| 10 |
+
try:
|
| 11 |
+
with open(JSON_FILE, "r", encoding="utf-8") as f:
|
| 12 |
+
data = json.load(f)
|
| 13 |
+
print("JSON loaded successfully, items:", len(data))
|
| 14 |
+
except Exception as e:
|
| 15 |
+
print("Error loading JSON:", e)
|