Sorry but you have to insert os.path.isfile( savepathQRcodes + f ) in your loop :
for f in QRfiles:
if os.path.isfile( savepathQRcodes + f ):
img = cv2.imread(savepathQRcodes + f)
if img is None:
print("File exists but imread cannot read it : ", savepathQRcodes + f)
else:
detector = cv2.QRCodeDetector()
data, bbox, straight_qrcode = detector.detectAndDecode(img)
if data == '':
count+=1
missing.append(f)
print("There is no data in file : ", savepathQRcodes + f)
else :
print(data)
else:
print("This file does not exist : ", savepathQRcodes + f)
What’s your platform and opencv version ?