Jofthomas HF Staff commited on
Commit
51c0570
·
verified ·
1 Parent(s): 2c01d99

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +19 -0
main.py CHANGED
@@ -725,6 +725,25 @@ async def get_last_action():
725
  """Serves a simple HTML page displaying the content of last_action.txt."""
726
  file_content_raw = ""
727
  error_message = None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
  try:
729
  # Read the file content fresh on each request
730
  with open(LAST_ACTION_FILE, "r", encoding="utf-8") as f:
 
725
  """Serves a simple HTML page displaying the content of last_action.txt."""
726
  file_content_raw = ""
727
  error_message = None
728
+ # --- Add Debugging ---
729
+ print("--- Debugging /last_action ---")
730
+ current_cwd = os.getcwd()
731
+ print(f"Current Working Directory: {current_cwd}")
732
+ absolute_path = os.path.abspath(LAST_ACTION_FILE)
733
+ print(f"Attempting to read absolute path: {absolute_path}")
734
+ print(f"Checking existence with os.path.exists: {os.path.exists(absolute_path)}")
735
+ try:
736
+ print(f"Listing contents of CWD ({current_cwd}): {os.listdir(current_cwd)}")
737
+ except Exception as list_err:
738
+ print(f"Could not list CWD: {list_err}")
739
+ try:
740
+ # Explicitly check /app if CWD is different
741
+ if current_cwd != '/app':
742
+ print(f"Listing contents of /app: {os.listdir('/app')}")
743
+ except Exception as list_err:
744
+ print(f"Could not list /app: {list_err}")
745
+ print("--- End Debugging ---")
746
+ # --- End Debugging ---
747
  try:
748
  # Read the file content fresh on each request
749
  with open(LAST_ACTION_FILE, "r", encoding="utf-8") as f: