# /home/user/app/assets/logo.py | |
from pathlib import Path | |
def get_logo_path() -> str: | |
""" | |
Returns the absolute string path to the logo.png file. | |
Assumes logo.png is in the same 'assets' directory as this script. | |
""" | |
# Path(__file__) is the path to this assets/logo.py file. | |
# .resolve().parent gives the 'assets' directory. | |
assets_dir = Path(__file__).resolve().parent | |
logo_file = assets_dir / "logo.png" # MAKE SURE 'logo.png' IS THE CORRECT FILENAME | |
if not logo_file.exists(): | |
# Handle the case where the logo is not found. | |
# You might want to log an error or return a default path. | |
# For now, let's print a warning and potentially raise an error or return None. | |
print(f"WARNING: Logo image not found at {str(logo_file)}") | |
# Depending on how pdf_report.py handles a missing logo, | |
# you might return None or a placeholder path. | |
# If generate_pdf_report expects a valid path, this could still error later. | |
return "" # Or raise FileNotFoundError(f"Logo not found: {logo_file}") | |
return str(logo_file) |