I'm facing "[Errno 13] Permission denied" error can any one help

asked 2019-07-11 03:26:50 -0600

updated 2019-07-11 06:34:32 -0600

supra56 gravatar image

the full error message is : PermissionError: [Errno 13] Permission denied: 'F:/PetImages/train/Dog'

and the code is :

train_dir = 'F:/PetImages/train'
test_dir = 'F:/PetImages/test'

train_dogs = ['F:/PetImages/train/{}'.format(i) for i in os.listdir(train_dir) if 'Dog' in i]
train_cats = ['F:/PetImages/train/{}'.format(i) for i in os.listdir(train_dir) if 'Cat' in i]

test_img = ['F:/PetImages/test/{}'.format(i) for i in os.listdir(test_dir)]

train_imgs = train_dogs[:200] + train_cats[:2000]

random.shuffle(train_imgs)

import matplotlib.image as mpimg
for ima in train_imgs[0:3]:
    img = mpimg.imread(ima)
    imgplot = plt.imshow(img)
    plt.show()
edit retag flag offensive close merge delete