I am getting an error that I don't understand. The code is intended to load an XLSX file using openpyxl and then read some stuff etc. It works fine locally but then fails on pythonanywhere. All packages are installed. If I give the correct path by hardcoding it works fine.
The error message from the log file is:
FileNotFoundError: [Errno 2] No such file or directory: '/home/PaulHermans/settings.xlsx'
This is the wrong path. It should be:
/home/PaulHermans/ab_calendar_v3/settings.xlsx
The relevant code is in main.py file that is located in:
/home/PaulHermans/ab_calendar_v3
The actual code that is causing the error is:
from pathlib import Path
settings_file = Path("setttings.xlsx").resolve()
wkb = openpyxl.load_workbook(settings_file)
Which should resolve to the absolute path of the settings.xlsx file but it "loses" the "ab_calendar_v3" directory for some reason when running on PythonAnywhere
Any suggestions would be appreciated!
PS - I am using Python 3.9