I generate a qr code image from an url using the python package qrcode:
url='www.google.com'
qr = qrcode.QRCode(version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4)
qr.add_data(url)
qr.make(fit=True)
img = qr.make_image()
return img
How do I save the img to the disk at a certain path ?
I tried:
image_file = open(path_qr_code, 'w')
image_file.write(img)
image_file.close
but I get:
TypeError: write() argument must be str, not PilImage