Forums

"No such file or directory" error in Flask application

I'm getting the following error in my application:

FileNotFoundError: [Errno 2] No such file or directory: 'inputs/ltm_data.csv'

However, this file is definitely present in the location /home/MyUserName/mysite/inputs.

This error only occurs when trying to run through PythonAnywhere and does not arise when running locally on my PC.

The code I'm using to read in this csv file is pd.read_csv('inputs/ltm_data.csv'). Could I perhaps need to modify the path?

See https://help.pythonanywhere.com/pages/NoSuchFileOrDirectory/