'jupyter notebook: [WinError 3] The system cannot find the path specified:

I got images in this fileenter image description here

and i want to load it into my code to use it for train a CNN model, and I'm using this code: note : i used plt.imshow() and break method just to desply the first image

import numpy as np
import matplotlib.pyplot as plt
import os
import cv2

DATADIR = "X:/wavess/PYDATA"
CATEGORIES = ["healthy","parkinson"]

for category in CATEGORIES:
    path = os.path.join(DATADIR, category)
    z = os.listdir(path)
    for img in z :
        img_array = cv2.imread(os.path.join(path, img))
        plt.imshow(img_array)
        plt.show
        break
    break

when i run this code i keep getting this error: FileNotFoundError: [WinError 3] The system cannot find the path specified: 'X:/wavess/PYDATA\healthy'

can any one tell me why I'm getting this error? and how i can solve this problem



Solution 1:[1]

I found the answer. I had to put "r" before the string, so it'll be like this:

 DATADIR = r'X:/wavess/PYDATA'

Solution 2:[2]

try using

DATADIR = "X:\wavess\PYDATA"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ouflak
Solution 2 amy989