I am creating a decision tree and I give it a picture of either a cat or dog and it will decide whether it can detect if it is a cat or dog. I created a directory in my project called 'Images' and put a picture of a dog in it. Yet os cannot find the directory. I have tried many different types of ways to fetch the directory but it hasn't worked.
Asked
Active
Viewed 57 times
0
-
Or https://stackoverflow.com/questions/17658856/why-am-i-getting-a-filenotfounderror – mkrieger1 Oct 08 '22 at 20:59
-
Or https://stackoverflow.com/questions/34304044/pycharm-current-working-directory – mkrieger1 Oct 08 '22 at 21:01
1 Answers
1
It looks like you've messed up your directory structure in the script:
- On line 19 you append a category name to
Images
folder; - After that, you're looking for the images in
Images\\Dog
andImages\\Cat
(listdir
on line 20), butCat
andDog
folders don't exist insideImages
.
Either create Cat
and Dog
directories inside Images
and move pictures there or change your code according to the file structure.

Max Skoryk
- 404
- 2
- 10