def read_images(path, fileNameFilter=FileNameFilter("None"), sz=None):
    c = 0
    X,y = [], []
    for dirname, dirnames, filenames in os.walk(path):
        for subdirname in dirnames:
            subject_path = os.path.join(dirname, subdirname)
            for filename in os.listdir(subject_path):
                if fileNameFilter(filename):
                    try:
                        im = Image.open(os.path.join(subject_path, filename))
                        im = im.convert("L")
                        # resize to given size (if given)
                        if (sz is not None):
                            im = im.resize(sz, Image.ANTIALIAS)
                        X.append(np.asarray(im, dtype=np.uint8))
                        y.append(c)
                    except IOError, (errno, strerror):
                        print "I/O error({0}): {1}".format(errno, strerror)
                    except:
                        print "Unexpected error:", sys.exc_info()[0]
                        raise         
            c = c+1
    return [X,y]
Ensure calling context_id when none exists returns None.
dataset/ETHPy150Open bytefish/facerec/py/apps/scripts/lpq_experiment.py/read_images--crossover with--dataset/ETHPy150Open Workiva/furious/furious/tests/test_async.py/TestAsync.test_no_context_id