IOError: cannot identify image file 'dataSet/.DS_Store [closed]

asked 2017-04-09 04:10:58 -0600

MS23 gravatar image

I have code as follows :

import os
import cv2
import numpy as np
from PIL import Image

path = 'data'

def grabImage(path):
    imagePaths=[os.path.join(path,f) for f in os.listdir(path)]
    faces=[]
    IDs=[]
    for imagePath in imagePaths:
        faceImg=Image.open(imagePath).convert('L') 

    return IDs, faces

IDs,faces=grabImage(path)

I get error as follows :

Traceback (most recent call last):
File "t.py", line 24, in <module>
IDs,faces=grabImage(path)
File "t.py", line 14, in F
faceImg=Image.open(imagePath).convert('L')
File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 2452, in open
% (filename if filename else fp))
IOError: cannot identify image file 'data/.DS_Store'

So on searching I realised .DS_Store is hidden file type in MacOS and hence the error, but I don't understand what needs to be done to get rid of it?

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2017-04-09 04:21:20.291098

Comments

entirely unrelated to opencv (and thus the wrong place to ask)

berak gravatar imageberak ( 2017-04-09 04:19:43 -0600 )edit
berak gravatar imageberak ( 2017-04-09 04:32:51 -0600 )edit