** Description changed:

+ === 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
+   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
+   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
+   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
+   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
+   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.")
+   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.")
+   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.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1573577

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

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

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to