Jan-14-2021, 08:11 AM
Does this indicate a computer memory problem?
I read a csv file with student names and number in to a dictionary: numsnames
The dictionary has 162 items. key is student number, value is name.
I want to make a QR code for each student from the dictionary:
In all there are 20 names/numbers missing, or 20 QR codes without data.
Is this a computer memory problem??
I read a csv file with student names and number in to a dictionary: numsnames
The dictionary has 162 items. key is student number, value is name.
I want to make a QR code for each student from the dictionary:
for key in numsnames.keys():
filename = f'/home/pedro/winter2020/20BE/QRcodes_20BE/{key}QR.png'
data = key + ':' + numsnames[key]
# instantiate QRCode object
qr = qrcode.QRCode(version=1, box_size=10, border=4)
# add data to the QR code
qr.add_data(data)
# compile the data into a QR code array
qr.make()
# transfer the array into an actual image
img = qr.make_image(fill_color="black", back_color="white")
# save it to a file
img.save(filename)To check, I print the data from the QR code:QRfiles = os.listdir(savepathQRcodes)
QRfiles.sort()
for f in QRfiles:
img = cv2.imread(savepathQRcodes + file)
detector = cv2.QRCodeDetector()
data, bbox, straight_qrcode = detector.detectAndDecode(img)
#text = data.split(':')
#print('number, name: ', text[0], text[1])
print(data)What I get has bits missing:Quote:pedro@pedro-512ssd:~/myPython$ ./qrCodes_for_studentsV1.py
numsnames is 162 long.
1825010141:陆遥
2025010101:白雪妮
2025010102:曹颖
2025010103:陈妍朵
2025010104:戴金珂
2025010105:段赵元
2025010106:段卓含
2025010108:范玉虹
2025010109:高萌婧
2025010110:高飒飒
2025010111:郭其平
2025010112:侯文美
2025010113:胡蝶
2025010115:胡沁恬
In all there are 20 names/numbers missing, or 20 QR codes without data.
Is this a computer memory problem??