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

crashes when generating qrcode #7

Closed
anarcat opened this issue Feb 3, 2016 · 2 comments
Closed

crashes when generating qrcode #7

anarcat opened this issue Feb 3, 2016 · 2 comments

Comments

@anarcat
Copy link

anarcat commented Feb 3, 2016

this is a forward of https://bugs.debian.org/813602 that was reported against the monkeysign package.

it seems that PIL changed the way you generate images from strings:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/monkeysign/gtkui.py", line 306, in expose_event
    self.draw_qrcode()
  File "/usr/lib/python2.7/dist-packages/monkeysign/gtkui.py", line 317, in draw_qrcode
    self.pixbuf = self.image_to_pixbuf(self.make_qrcode(self.active_key.fpr))
  File "/usr/lib/python2.7/dist-packages/monkeysign/gtkui.py", line 342, in make_qrcode
    version, width, image = _qrencode_scaled('OPENPGP4FPR:'+fingerprint,size,0,1,2,True)
  File "/usr/lib/python2.7/dist-packages/qrencode/__init__.py", line 69, in encode_scaled
    version, src_size, im = encode(data, version, level, hint, case_sensitive)
  File "/usr/lib/python2.7/dist-packages/qrencode/__init__.py", line 47, in encode
    im = Image.fromstring('L', (size, size), data)
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2063, in fromstring
    "Please call frombytes() instead.")
Exception: fromstring() has been removed. Please call frombytes() instead.

this is with PIL 3.1.0.

runejuhl added a commit to runejuhl/pyqrencode that referenced this issue Jun 7, 2016
@runejuhl
Copy link

runejuhl commented Jun 7, 2016

The issue is fixed in the branch referenced here. I haven't put any effort into trying to keep backwards compatibility, so there's that. If anyone can tell me which, if any, PIL versions that do not have the frombytes function, I'd be happy to update it.

@anarcat
Copy link
Author

anarcat commented Mar 3, 2023

looks like this was fixed in 1.2, thanks!

@anarcat anarcat closed this as completed Mar 3, 2023
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

2 participants