Spaces:
Running
Running
Commit
·
0906da9
1
Parent(s):
da36223
Fix nbainjuries import to handle missing JVM gracefully
Browse files- src/injury_collector.py +7 -5
src/injury_collector.py
CHANGED
|
@@ -11,14 +11,16 @@ from typing import Optional, Dict, List
|
|
| 11 |
import json
|
| 12 |
import logging
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
| 15 |
try:
|
| 16 |
from nbainjuries import injury as nba_injury
|
| 17 |
HAS_NBA_INJURIES = True
|
| 18 |
-
except
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
logging.warning("nbainjuries package not installed. Using fallback injury data.")
|
| 22 |
|
| 23 |
from src.config import API_CACHE_DIR, INJURY_IMPACT
|
| 24 |
|
|
|
|
| 11 |
import json
|
| 12 |
import logging
|
| 13 |
|
| 14 |
+
# nbainjuries requires Java/JVM - make import completely optional
|
| 15 |
+
HAS_NBA_INJURIES = False
|
| 16 |
+
nba_injury = None
|
| 17 |
+
|
| 18 |
try:
|
| 19 |
from nbainjuries import injury as nba_injury
|
| 20 |
HAS_NBA_INJURIES = True
|
| 21 |
+
except Exception as e:
|
| 22 |
+
# Catch ALL exceptions (ImportError, JVMNotFoundException, etc.)
|
| 23 |
+
logging.debug(f"nbainjuries not available: {e}")
|
|
|
|
| 24 |
|
| 25 |
from src.config import API_CACHE_DIR, INJURY_IMPACT
|
| 26 |
|