QR code image does not generate after upgrade to Ubuntu 16.04
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Qreator |
Fix Committed
|
Critical
|
David Planella | ||
python-qrencode (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned | ||
qreator (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned |
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.
[Test Case]
Run the following script and see if it ends in an exception:
```
import qrencode
qrencode.
```
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.
-------
Exception Traceback (most recent call last)
<ipython-
----> 1 qrencode.
/usr/lib/
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/
45 version, size, data = _encode(data, version, level, hint, False)
46
---> 47 im = Image.fromstrin
48 return (version, size, im)
49
/usr/lib/
2061 def fromstring(*args, **kw):
2062 raise Exception(
-> 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/
from gi.repository import GObject, Gtk # pylint: disable=E0611
/usr/share/
from gi.repository import Gtk, GtkChamplain, Clutter, Champlain
/usr/share/
from gi.repository import GtkClutter
/usr/share/
from gi.repository import Gtk, NetworkManager, NMClient, GLib, GdkPixbuf
/usr/share/
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/
output_
File "/usr/share/
border)
File "/usr/share/
current_
File "/usr/share/
version, self.qrcode_size, self.image = qrencode.
File "/usr/lib/
im = Image.fromstrin
File "/usr/lib/
"Please call frombytes() instead.")
Exception: fromstring() has been removed. Please call frombytes() instead.
Traceback (most recent call last):
File "/usr/share/
output_
File "/usr/share/
border)
File "/usr/share/
current_
File "/usr/share/
version, self.qrcode_size, self.image = qrencode.
File "/usr/lib/
im = Image.fromstrin
File "/usr/lib/
"Please call frombytes() instead.")
Exception: fromstring() has been removed. Please call frombytes() instead.
Related branches
- David Planella: Pending requested
-
Diff: 11 lines (+1/-1)1 file modifiedqreator/QRCode.py (+1/-1)
Changed in qreator: | |
status: | New → Confirmed |
Changed in qreator: | |
milestone: | none → 16.06.1 |
Changed in qreator: | |
status: | Triaged → Fix Committed |
Changed in qreator: | |
importance: | High → Critical |
assignee: | nobody → David Planella (dpm) |
description: | updated |
The fix is to replace tostring" with "self.image. tobytes" in /usr/share/ qreator/ qreator/ QRCode. py:76 and python2. 7/dist- packages/ qrencode/ __init_ _.py:47
"self.image.
"Image.fromstring" with "Image.frombytes" in /usr/lib/
The latter is a bug in python-qrencode, which has already been reported at https:/ /bugs.launchpad .net/ubuntu/ +source/ python- qrencode/ +bug/1587249