Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
ad132ba
1
Parent(s):
415709d
Refactor path handling in nhl_functions.py to clarify Go binary location, updating comments for better understanding of directory structure and ensuring correct binary execution from project root.
Browse files
src/sports/nhl_functions.py
CHANGED
|
@@ -95,16 +95,16 @@ def run_go_classic_lineup_generator(site="DK", sport="NHL"):
|
|
| 95 |
st.write(f"Starting Go {sport} lineup generation...")
|
| 96 |
start_time = time.time()
|
| 97 |
|
| 98 |
-
# Determine the path to the Go binary
|
| 99 |
-
# __file__ is at src/sports/nhl_functions.py
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
|
| 104 |
if site == "DK":
|
| 105 |
-
go_binary = os.path.join(
|
| 106 |
else:
|
| 107 |
-
go_binary = os.path.join(
|
| 108 |
|
| 109 |
st.write(f"Looking for binary at: {go_binary}")
|
| 110 |
|
|
@@ -138,7 +138,7 @@ def run_go_classic_lineup_generator(site="DK", sport="NHL"):
|
|
| 138 |
st.write(f"Error: Go binary not found at {go_binary}")
|
| 139 |
st.write(f"FileNotFoundError: {e}")
|
| 140 |
st.write(f"Current working directory: {os.getcwd()}")
|
| 141 |
-
st.write(f"
|
| 142 |
return False
|
| 143 |
except Exception as e:
|
| 144 |
st.write(f"Unexpected error: {e}")
|
|
|
|
| 95 |
st.write(f"Starting Go {sport} lineup generation...")
|
| 96 |
start_time = time.time()
|
| 97 |
|
| 98 |
+
# Determine the path to the Go binary
|
| 99 |
+
# __file__ is at /app/src/sports/nhl_functions.py
|
| 100 |
+
# Binaries are at /app/dk_nhl_go/ and /app/fd_nhl_go/ (per Dockerfile)
|
| 101 |
+
current_dir = os.path.dirname(os.path.abspath(__file__)) # /app/src/sports/
|
| 102 |
+
project_root = os.path.dirname(os.path.dirname(current_dir)) # /app/
|
| 103 |
|
| 104 |
if site == "DK":
|
| 105 |
+
go_binary = os.path.join(project_root, "dk_nhl_go", "NHL_seed_frames")
|
| 106 |
else:
|
| 107 |
+
go_binary = os.path.join(project_root, "fd_nhl_go", "NHL_seed_frames")
|
| 108 |
|
| 109 |
st.write(f"Looking for binary at: {go_binary}")
|
| 110 |
|
|
|
|
| 138 |
st.write(f"Error: Go binary not found at {go_binary}")
|
| 139 |
st.write(f"FileNotFoundError: {e}")
|
| 140 |
st.write(f"Current working directory: {os.getcwd()}")
|
| 141 |
+
st.write(f"Project root: {project_root}")
|
| 142 |
return False
|
| 143 |
except Exception as e:
|
| 144 |
st.write(f"Unexpected error: {e}")
|