Bug 1017561

Summary: [abrt] system-config-printer-1.4.2-1.fc19: newprinter.py:2683:on_tvNPDevices_cursor_changed:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 44: ordinal not in range(128)
Product: [Fedora] Fedora Reporter: Terry Moschou <tmoschou>
Component: system-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: jpopelka, nathanael, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:9dd32a55a187b62c1c5606d077fc3004fac4106e
Fixed In Version: system-config-printer-1.4.3-2.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-06 07:39:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: environ none

Description Terry Moschou 2013-10-10 07:43:23 UTC
Description of problem:
Started system-config-printer from kickoff KDE.
Actually there are several printer config menu items for some reason.
I believe the one I chose corresponds to 
/usr/share/applications/system-config-printer.desktop
from package 'system-config-printer-1.4.2-1.fc19.x86_64'
the other was 
/usr/share/kde4/services/kcm_printer_manager.desktop
from package 'kde-print-manager-4.11.1-1.fc19.x86_64'

Went to add new printer
Authenticated as admin, twice.
First case:
  System policy prevents to change the firewall configuration
  Action: Firewall configuration
  Vendor: FirewallD
Second case:
  Privileges are required to get list of available devices
  Action: Get list of available devices
  Vendor: The openSUSE Project

openSUSE? should that be right?

Under Devices->Network Printer several entries marked 'None' appeared after a while.
I sellected one of them, before the error occured.

Version-Release number of selected component:
system-config-printer-1.4.2-1.fc19

Additional info:
reporter:       libreport-2.1.7
cmdline:        /usr/bin/python /usr/share/system-config-printer/system-config-printer.py
dso_list:       system-config-printer-libs-1.4.2-1.fc19.noarch
executable:     /usr/share/system-config-printer/system-config-printer.py
kernel:         3.11.3-201.fc19.x86_64
runlevel:       N 5
type:           Python
uid:            1000

Truncated backtrace:
newprinter.py:2683:on_tvNPDevices_cursor_changed:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 44: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/share/system-config-printer/newprinter.py", line 2683, in on_tvNPDevices_cursor_changed
    device.menuentry += " (%s)" % device.info
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 44: ordinal not in range(128)

Local variables in innermost frame:
widget: <TreeView object at 0x306fa00 (GtkTreeView at 0x320c4b0)>
name: u'HP%20Photosmart%20C4400%20series%20%40%20Devin%20Methven%E2%80%99s%20MacBook%20Pro._ipp._tcp.local'
column: <TreeViewColumn object at 0x3ccc870 (GtkTreeViewColumn at 0x345a4b0)>
cupsqueue: u'cups'
self: <NewPrinterGUI object at 0x306f500 (newprinter+NewPrinterGUI at 0x32916a0)>
rest: None
physicaldevice: <PhysicalDevice.PhysicalDevice (Photosmart,C4400,)>
iter: <GtkTreeIter at 0x3e4ad00>
device: <cupshelpers.Device "dnssd://HP%20Photosmart%20C4400%20series%20%40%20Devin%20Methven%E2%80%99s%20MacBook%20Pro._ipp._tcp.local/cups">
path: <GtkTreePath at 0x38f97a0>
model: <TreeStore object at 0x3ce8960 (GtkTreeStore at 0x3586b90)>
scheme: u'dnssd'

Comment 1 Terry Moschou 2013-10-10 07:43:28 UTC
Created attachment 810349 [details]
File: backtrace

Comment 2 Terry Moschou 2013-10-10 07:43:32 UTC
Created attachment 810350 [details]
File: environ

Comment 3 Jiri Popelka 2013-10-10 14:21:15 UTC
(In reply to Terry Moschou from comment #0)
>   Vendor: The openSUSE Project
> openSUSE? should that be right?

That's correct, yes. cups-pk-helper originates from openSUSE.
http://www.vuntz.net/journal/post/2010/02/19/A-few-words-about-cups-pk-helper...
 
> Under Devices->Network Printer several entries marked 'None' appeared after
> a while. I sellected one of them, before the error occured.

Hmm, I don't remember ever seeing any 'None' entries there.

>     device.menuentry += " (%s)" % device.info
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 44:
> ordinal not in range(128)

Means that device.menuentry was unicode while device.info was (utf-8) encoded,
I'll check what can be done here.

Comment 5 Nathanael Noblet 2013-10-17 00:22:30 UTC
doesn't seem to fix it for me. (I manually edited that line (2685) in a similar way and I got 

device.menuentry += " (%s)" % [ device.info('utf-8') if isinstance(w,bytes) else w for w in device.info ]
TypeError: 'str' object is not callable

Probably did it wrong however I also applied the patch linked to above. Still no go.

Comment 6 Jiri Popelka 2013-10-17 07:41:14 UTC
I actually made one more commit later.
https://git.fedorahosted.org/cgit/system-config-printer.git/commit/?id=856349f18be42f0c95e1f021c348d4858e54a1f3

Would be great if you could try it too.
You can simply replace
/usr/share/system-config-printer/newprinter.py
with
https://git.fedorahosted.org/cgit/system-config-printer.git/plain/newprinter.py

If that doesn't help I'll add some debug outputs so we can see what is actually going on there.

Comment 7 Nathanael Noblet 2013-10-17 14:55:05 UTC
So after struggling with it for a bit I renamed the computer that was advertising the printer and this solved the issue. Its an iMac so they do some stupid "Soand-So's-iMac" naming convention. My guess is that the apostrophe is one of those odd apostrophe's similar to the ones MS uses the 'Smart/Curly' apostrophe. Anyway I'll rename the computer and try out your file and report back.

Comment 8 Fedora Update System 2013-10-22 16:55:43 UTC
system-config-printer-1.4.3-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/system-config-printer-1.4.3-1.fc20

Comment 9 Fedora Update System 2013-10-22 16:58:02 UTC
system-config-printer-1.4.3-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/system-config-printer-1.4.3-1.fc19

Comment 10 Fedora Update System 2013-10-23 03:30:44 UTC
Package system-config-printer-1.4.3-1.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing system-config-printer-1.4.3-1.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-19726/system-config-printer-1.4.3-1.fc19
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2013-11-06 07:39:17 UTC
system-config-printer-1.4.3-2.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2013-11-10 07:44:15 UTC
system-config-printer-1.4.3-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.