FileNotFoundError: No such file or directory

Hello, sorry if Im in the wrong Topic.

I started to train a deep learning module in:

“C:\Users\User\Documents\ml-basics”.

I set up a Flask in the same directory and ran it.
Everything was fine until I moved those files into a different directory:

“C:\Users\User”.

When I try to run the Flask now, all of a sudden, it gives me the Error:

“FileNotFoundError: [Errno 2] No such file or directory: ‘currency_pair_lstm_model.pth’”

The Flask.py file and the DeepLearning.ipynb file are in the same “C:\Users\User” directory.

What am I doing wrong?

Thank you!

I tried to check with the command in a .py file:

import os

file_name = ‘currency_pair_lstm_model.pth’
file_path = os.path.abspath(file_name)

print(f"The full path to the file is: {file_path}")

if os.path.exists(file_path):
print(f"The file exists at: {file_path}")
else:
print(“The file does not exist.”)

and got:

The full path to the file is: C:\Users\User\currency_pair_lstm_model.pth
The file does not exist.

How come the path to the file can be found but the file itself does not exist??

Usually this should not happen. Will it be OK if you can share the process screenshot and the location of the file in the explorer. I am also new to this but I want to check since this seems to be a basic issue.

Thank you but I solved it already. The problem was the currency_pair_lstm_model.pth file was a separate file to my deep learning module code. Which was still in the old directory…

great.
I was having doubt about the same, that is the reason why I asked you for the same at the first place. Because usually it does not happen.