On debian stretch hp-toolbox fails at status page because of a trival programing error using python str

Bug #1760090 reported by charisz
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
HPLIP
In Progress
Undecided
Unassigned

Bug Description

Debian 9.4, python 2.7.13, hplip 3.18.3
On hp-toolbox gui if status page is choosen, the application crashes.

Traceback (most recent call last):
  File "/usr/share/hplip/ui5/devmgr5.py", line 569, in Tabs_currentChanged
    self.TabIndex[tab]()
  File "/usr/share/hplip/ui5/devmgr5.py", line 1315, in updateStatusTab
    self.updateStatusTable()
  File "/usr/share/hplip/ui5/devmgr5.py", line 1410, in updateStatusTable
    tt = str("%s %s"%(dt.toString(),desc))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 3: ordinal not in range(128)

Traceback (most recent call last):
  File "/usr/share/hplip/ui5/devmgr5.py", line 569, in Tabs_currentChanged
    self.TabIndex[tab]()
  File "/usr/share/hplip/ui5/devmgr5.py", line 1315, in updateStatusTab
    self.updateStatusTable()
  File "/usr/share/hplip/ui5/devmgr5.py", line 1431, in updateStatusTable
    i = QTableWidgetItem(str(t))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 3: ordinal not in range(128)

devmgr5.py
line 1410 >> tt = str("%s %s"%(dt.toString(), desc))
line 1431 >> i = QTableWidgetItem(str(t))

In this line the coercing to string is not work because the values can contain unicode characters.
Using "to_uncode" function (from the sourcecode of hplip) in these cases will solve the problem.

By-the-way Can I found the source code somewhere, perhaps I could file a PR?

charisz (charisz)
description: updated
Revision history for this message
Shivani Mandora (shivani1709) wrote :

Hi,

Debian 9.4 is not yet supported by HPLIP , so some functionalities might fail . Please use any previous versions of Debian.you can download supported hplip version source code from this link.
https://sourceforge.net/projects/hplip/files/hplip/
Debian 9.4 will be supported by HPLIP in the future release.

Thanks,
Shivani mandora.

Changed in hplip:
status: New → In Progress
Revision history for this message
Alejandro Dini (alete89) wrote :

it also affects me in debian, but debian or its version is not the problem:

alejandro@debian:~$ hp-toolbox

HP Linux Imaging and Printing System (ver. 3.18.10)
HP Device Manager ver. 15.0

Copyright (c) 2001-15 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

warning: Fax disabled.
warning: Fax disabled.
warning: Please install version 2.0+ of Reportlab for coverpage support.

##CLICK ON STATUS TAB AND THEN:

\Traceback (most recent call last):
  File "/usr/share/hplip/ui5/devmgr5.py", line 569, in Tabs_currentChanged
    self.TabIndex[tab]()
  File "/usr/share/hplip/ui5/devmgr5.py", line 1315, in updateStatusTab
    self.updateStatusTable()
  File "/usr/share/hplip/ui5/devmgr5.py", line 1409, in updateStatusTable
    tt = str("%s %s"%(dt.toString(),desc))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 2: ordinal not in range(128)
Aborted
alejandro@debian:~$

Revision history for this message
Alejandro Dini (alete89) wrote :

I confirm what ~charisz said

'' Using "to_uncode" function (from the sourcecode of hplip) in these cases will solve the problem. ''

changing from str() to to_unicode() in lines 1409 and 1431 fixes this issue.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.