import os, cv2, imagehash, PIL
hashList = []
path = "C:\cardscryer\CardScryer-master\pictures"
folderList = os.listdir(path)
print(folderList)
os.chdir(path)
for folder in folderList:
fileList = os.listdir(folder)
for file in fileList:
cardImage = cv2.imread(os.path.join(folder, file))
cropImage = cardImage[15:200, 20:420]
hash = imagehash.phash(PIL.Image.fromarray(cropImage))
file = file.replace('.jpg','')
print(file)
hashList.append([file[:-4], folder, hash])
「cv2.imread(os.path.join(folder, file))」は、次の割り当てで nonetype エラーが発生するため、何らかの理由で none として返されると思いますが、すべてのサブフォルダーが実行されている場合にのみ壊れます。エラーが発生したサブフォルダーのみで実行するように変更します。それはうまくいきます。このような小さな変更でリターンが異なることに最も困惑しています。