lincolnloop / python-qrcode

Python QR Code image generator
https://pypi.python.org/pypi/qrcode
Other
4.34k stars 664 forks source link

AttributeError: 'function' object has no attribute 'make' in Flask web app. #218

Closed bilalkhann16 closed 3 years ago

bilalkhann16 commented 3 years ago

I'm trying to generate QR Code in Flask web app but my code is throwing this error. I've already installed qrcode and pillow.

@app.route('/qr')
def qrcode():
   img = qrcode.make('https://youtube.com')
   img.save('first-image1.png')
   return 'all good'
heuer commented 3 years ago

Rename the function, see also #217

import qrcode

def make_qrcode():
    img = qrcode.make('https://youtube.com')
    img.save('first-image1.png')
bilalkhann16 commented 3 years ago

Thanks, it worked. I was literally stuck for half an hour trying to figure out ):