Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'str' object has no attribute 'write' #306

Closed
Nicolalorettu opened this issue Feb 3, 2023 · 2 comments
Closed

AttributeError: 'str' object has no attribute 'write' #306

Nicolalorettu opened this issue Feb 3, 2023 · 2 comments

Comments

@Nicolalorettu
Copy link

I tried the library in both linux vm and windows 11 with the same results

import qrcode
img = qrcode.make("https://www.youtube.com/")
img.save("youtubeQR.jpg")

@texnofobix
Copy link

I had to install pip install qrcode[pil], and it worked. Looks like it should work without it, so the issue is valid.

@SmileyChris
Copy link
Member

This should work now without pil (although it'll be a png file even if you called it "something.jpg") in the version I just released.

Previously the pure png factory needed :

with open("youtubeQR.jpg", "wb") as f:
    img.save(f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants