Face recognition Jarvis project error

hello friends,
i have been making my own personel AI for sometime now so i built a face recognition script
and in that script whenever i try to run it . it shows me the error ===

[ERROR:0@0.045] global persistence.cpp:512 cv::FileStorage::Impl::open Can’t open file: ‘haarcascade_frontalface_default.xml’ in read mode
Training faces. It will take a few seconds. Wait …
Traceback (most recent call last):
File “d:/J.A.R.V.I.S/Face-Recognition/Model Trainer.py”, line 35, in
faces,ids = Images_And_Labels(path)
File “d:/J.A.R.V.I.S/Face-Recognition/Model Trainer.py”, line 15, in Images_And_Labels
imagePaths = [os.path.join(path,f) for f in os.listdir(path)]
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'samples

if someone has any solutions please tell otherwise i will have to quit my 2 months work script. please

Probably this has something to do with the content of the script. It might be possible to help you in detail if we can see the relevant code. But better yet will be to apply standard debugging techniques and, if you find something that you can’t understand, to produce a minimal reproducible example of the problematic code. Please also read the pinned thread and make sure you understand how the code formatting works here. Error messages should be formatted like multi-line code, because Python designed them with the expectation that you’ll read them inside a terminal window.

From what is shown here: the error message is showing one line out of many from your code, where a problem occurs: imagePaths = [os.path.join(path,f) for f in os.listdir(path)]. It says that The system cannot find the path specified: 'samples, and this is an Error because a File is NotFound. More specifically, the part of this code that tries to look for a file (actually a folder) is the os.listdir call. You should check the value that is being passed as the path and make sure that it makes sense.

yeah i get the part that it the file its looking for is not there but i manully made a sample folder pasted images in it for recognition but still it shows this should i send a screen shot of the whole code ? and thanks for your help sir.

Please do not post screenshots of code. Instead, please read the links I gave you, and take their advice into consideration. We want to see code as properly formatted text, so that we can easily read it, and also so that we can copy and paste it for discussion.

You should make sure you understand how paths work on a computer, and therefore where Python will look when you give it that folder name. References: