Python Forum
QR code data missing in some of my QR codes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QR code data missing in some of my QR codes
#1
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:

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??
Reply


Messages In This Thread
QR code data missing in some of my QR codes - by Pedroski55 - Jan-14-2021, 08:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Missing parts of Code Felipe1991_GVT 3 463 Mar-22-2024, 05:58 PM
Last Post: deanhystad
  How to read rainfall time series and insert missing data points MadsM 4 2,365 Jan-06-2022, 10:39 AM
Last Post: amdi40
  txt-file: read and append missing data sufi 1 3,327 Dec-07-2019, 08:12 AM
Last Post: Gribouillis
  First Byte of a string is missing while receiving data over TCP Socket shahrukh1987 3 4,408 Nov-20-2019, 10:34 AM
Last Post: shahrukh1987
  Unable to do the proper split using re.sub incase of missing data. Karz 1 1,943 Nov-17-2019, 05:58 PM
Last Post: buran
  I am trying to make a Colour Wars game, "Winning code" missing Ondrejoda 0 2,356 Feb-18-2018, 11:06 AM
Last Post: Ondrejoda

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020