johnx
johnx

Reputation: 35

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

Upvotes: 0

Views: 542

Answers (2)

johnx
johnx

Reputation: 35

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

 DATADIR = r'X:/wavess/PYDATA'

Upvotes: 1

amy989
amy989

Reputation: 313

try using

DATADIR = "X:\wavess\PYDATA"

Upvotes: 0

Related Questions