← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1573577] Re: QR code image does not generate after upgrade to Ubuntu 16.04

 

This bug was fixed in the package qreator - 13.05.3-2ubuntu1

---------------
qreator (13.05.3-2ubuntu1) xenial; urgency=medium

  * Fix PIL.Image.Image.tostring usage (LP: #1573577)

 -- Chow Loong Jin <hyperair@xxxxxxxxxx>  Thu, 14 Dec 2017 22:09:47
+0800

** Changed in: qreator (Ubuntu Xenial)
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1573577

Title:
  QR code image does not generate after upgrade to Ubuntu 16.04

Status in Qreator:
  Fix Committed
Status in python-qrencode package in Ubuntu:
  Fix Released
Status in qreator package in Ubuntu:
  Fix Released
Status in python-qrencode source package in Xenial:
  Fix Released
Status in qreator source package in Xenial:
  Fix Released

Bug description:
  === Begin SRU Boilerplate for Ubuntu ===

  [Impact]
  python-qrencode is currently broken for all users in xenial due to the removal of Image.fromstring from pillow. The fix is to replace all calls to Image.fromstring with Image.frombytes.

  qreator is also affected similarly in xenial, and requires a fix to
  switch the usage of PIL.Image.Image.tostring() with
  PIL.Image.Image.tobytes()

  [Test Case]
  Run the following script and see if it ends in an exception:

  ```
  import qrencode
  qrencode.encode_scaled("foo", 1)
  ```

  In the case of qreator:
  1. Launch Qreator after installing both the fixed qreator and python-qrencode packages.
  2. Create a QR code
  3. Verify that the QR code is displayed.
  4. Save the QR code
  5. Verify that the QR code was saved correctly.

  
  [Regression Potential]
  It's unlikely that python-qrencode can regress any further, because in its current state, both exported python methods are completely broken and will throw an exception unconditionally with the pillow version in Xenial.

  
  [Other Info]
  rdeps may also be broken if they use Image.tostring on the output. So far, the only known rdep that is broken is qreator.

  Below is the stack trace and exception thrown by the broken version of
  qrencode.

  In [5]: qrencode.encode_scaled("foo",1)
  ---------------------------------------------------------------------------
  Exception Traceback (most recent call last)
  <ipython-input-5-be07c22beab2> in <module>()
  ----> 1 qrencode.encode_scaled("foo",1)

  /usr/lib/python2.7/dist-packages/qrencode/__init__.pyc in encode_scaled(data, size, version, level, hint, case_sensitive)
       67 the QR-code.
       68 """
  ---> 69 version, src_size, im = encode(data, version, level, hint, case_sensitive)
       70 if size < src_size:
       71 size = src_size

  /usr/lib/python2.7/dist-packages/qrencode/__init__.pyc in encode(data, version, level, hint, case_sensitive)
       45 version, size, data = _encode(data, version, level, hint, False)
       46
  ---> 47 im = Image.fromstring('L', (size, size), data)
       48 return (version, size, im)
       49

  /usr/lib/python2.7/dist-packages/PIL/Image.pyc in fromstring(*args, **kw)
     2061 def fromstring(*args, **kw):
     2062 raise Exception("fromstring() has been removed. " +
  -> 2063 "Please call frombytes() instead.")
     2064
     2065

  Exception: fromstring() has been removed. Please call frombytes()
  instead.

  In [6]:

  
  === End SRU Boilerplate for Ubuntu ===


  
  [Original bug report]

  The program opens like normally, however it never displays a QR, even
  if you do Text, or URL, etc.  If it doesn't display the QR code, you
  can't save it, either.  Running from terminal, I'm getting lots of
  verbage that seems like a python 2.7 issue.

  /usr/share/qreator/qreator_lib/Builder.py:21: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
    from gi.repository import GObject, Gtk # pylint: disable=E0611
  /usr/share/qreator/qreator/qrcodes/QRCodeLocationGtk.py:17: PyGIWarning: GtkChamplain was imported without specifying a version first. Use gi.require_version('GtkChamplain', '0.12') before import to ensure that the right version gets loaded.
    from gi.repository import Gtk, GtkChamplain, Clutter, Champlain
  /usr/share/qreator/qreator/qrcodes/QRCodeLocationGtk.py:19: PyGIWarning: GtkClutter was imported without specifying a version first. Use gi.require_version('GtkClutter', '1.0') before import to ensure that the right version gets loaded.
    from gi.repository import GtkClutter
  /usr/share/qreator/qreator/qrcodes/QRCodeWifiGtk.py:20: PyGIWarning: NetworkManager was imported without specifying a version first. Use gi.require_version('NetworkManager', '1.0') before import to ensure that the right version gets loaded.
    from gi.repository import Gtk, NetworkManager, NMClient, GLib, GdkPixbuf
  /usr/share/qreator/qreator/qrcodes/QRCodeWifiGtk.py:20: PyGIWarning: NMClient was imported without specifying a version first. Use gi.require_version('NMClient', '1.0') before import to ensure that the right version gets loaded.
    from gi.repository import Gtk, NetworkManager, NMClient, GLib, GdkPixbuf
  No handlers could be found for logger "qreator_lib"
  Traceback (most recent call last):
    File "/usr/share/qreator/qreator/QreatorWindow.py", line 512, in on_qr_drawingarea_draw
      output_type=QRCodeOutput.CAIRO_SURFACE)
    File "/usr/share/qreator/qreator/QRCode.py", line 61, in encode
      border)
    File "/usr/share/qreator/qreator/QRCode.py", line 70, in _encode_to_cairo
      current_color_bg, previous_color_bg, border)
    File "/usr/share/qreator/qreator/QRCode.py", line 94, in _encode_to_pil
      version, self.qrcode_size, self.image = qrencode.encode(text)
    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.
  Traceback (most recent call last):
    File "/usr/share/qreator/qreator/QreatorWindow.py", line 512, in on_qr_drawingarea_draw
      output_type=QRCodeOutput.CAIRO_SURFACE)
    File "/usr/share/qreator/qreator/QRCode.py", line 61, in encode
      border)
    File "/usr/share/qreator/qreator/QRCode.py", line 70, in _encode_to_cairo
      current_color_bg, previous_color_bg, border)
    File "/usr/share/qreator/qreator/QRCode.py", line 94, in _encode_to_pil
      version, self.qrcode_size, self.image = qrencode.encode(text)
    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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qreator/+bug/1573577/+subscriptions