First of all, to make it easier for us to read your code you should ‘fence’ it with triple backticks (```), then this
```python
def foo(bar):
return bar * 2
```
will look like this
def foo(bar):
return bar * 2
To your question: Assuming that the line starting with =r"\C... refers to the file path, that file path should probably not end in ...\conv neural I\cats\ and just end in ...\conv neural I\. I believe this because the error states that the file you are trying to look up in the loop ends with \cats\\/cats, i.e. one \\cats too many.
i exctracted the folder from zip and i get a better path :
C:\Users\moi\Downloads\PARENT_ FOLDER\1577957291_deeplearningwithkerasandtensorflow (5)\data\test\cats
but with :
File “”, line 1
DIRECTORY =r"\C:\Users\moi\Downloads\PARENT_FOLDER\1577957291_deeplearningwithkerasandtensorflow (5)\data\test\cats
^
SyntaxError: EOL while scanning string literal
FileNotFoundError Traceback (most recent call last)
in
1 for categorie in CATEGORIES :
2 folder = os.path.join( DIRECTORY , categorie )
----> 3 for img in os.listdir(folder):
4 img_path = os.path.join (folder,img )
5 img_arr = cv2.imread(img_path )
FileNotFoundError: [Errno 2] No such file or directory: ‘\\C:\\Users\\moi\\Downloads\\PARENT_FOLDER\\1577957291_deeplearningwithkerasandtensorflow (5)\\data\\test\\cats/cats’
another try :
DIRECTORY =r’\C:\Users\moi\Downloads\PARENT_FOLDER\1577957291_deeplearningwithkerasandtensorflow (5)\data\test\cats\’
FileNotFoundError Traceback (most recent call last)
in
1 for categorie in CATEGORIES :
2 folder = os.path.join( DIRECTORY , categorie )
----> 3 for img in os.listdir(folder):
4 img_path = os.path.join (folder,img )
5 img_arr = cv2.imread(img_path )
FileNotFoundError: [Errno 2] No such file or directory: ‘\\C:\\Users\\moi\\Downloads\\PARENT_FOLDER\\1577957291_deeplearningwithkerasandtensorflow (5)\\data\\test\\cats\\/cats’