[SOLVED] slackware-current: hp-setup from hplip-3.23.12-x86_64-4 throws UnicodeDecodeError after selecting printer
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
slackware-current: hp-setup from hplip-3.23.12-x86_64-4 throws UnicodeDecodeError after selecting printer
When I try to add a printer using hp-setup to add a network printer I've successfully added in the past I get the error below.
Steps:
Run hp-setup from cli
Select "Network/Ethernet/Wireless network (direct connection or JetDirect)
Select my printer
Click "Next" followed by the crash
I see that there were patches applied to -4 to fix unicode errors, but they don't seem to work for whatever this is. I assume this is a system misconfiguration problem on my end, but I don't know where to start checking things.
Things I've tried:
downgrading hplip to 3.23.12-x86_64-1 through 3 (same error)
downgrading to hplip-3.20.6-x86_64-7 (ModuleNotFoundError: No module named 'cupsext')
reinstalling hplip
The trace:
Code:
HP Linux Imaging and Printing System (ver. 3.23.12)
Printer/Fax Setup Utility ver. 9.0
Copyright (c) 2001-18 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.
Searching... (bus=net, timeout=5, ttl=4, search=(None) desc=0, method=mdns)
...clipped some stuff here...
hp-setup[17284]: debug: Found 1 devices
hp-setup[17284]: debug: Cache miss: officejet_pro_9010_series
hp-setup[17284]: debug: Reading file: /usr/share/hplip/data/models/models.dat
hp-setup[17284]: debug: Searching for section [officejet_pro_9010_series] in file /usr/share/hplip/data/models/models.dat
hp-setup[17284]: debug: Found section [officejet_pro_9010_series] in file /usr/share/hplip/data/models/models.dat
hp-setup[17284]: debug: Cache miss: hp_officejet_pro_9010_series
hp-setup[17284]: debug: Reading file: /usr/share/hplip/data/models/models.dat
hp-setup[17284]: debug: Searching for section [hp_officejet_pro_9010_series] in file /usr/share/hplip/data/models/models.dat
hp-setup[17284]: debug: Found section [hp_officejet_pro_9010_series] in file /usr/share/hplip/data/models/models.dat
hp-setup[17284]: debug: Unable to open file /var/lib/hp/hplip.state for reading.
hp-setup[17284]: debug: {}
hp-setup[17284]: debug: HP_OfficeJet_Pro_9010
hp-setup[17284]: debug: (CUPS 1.2.x) Getting list of PPDs using CUPS_GET_PPDS...
hp-setup[17284]: debug: CUPS PPD base path = /usr/share/cups/model
hp-setup[17284]: debug: Foomatic PPD base path = /usr/share/ppd
Traceback (most recent call last):
File "/usr/share/hplip/ui5/setupdialog.py", line 1395, in NextButton_clicked
self.showAddPrinterPage()
File "/usr/share/hplip/ui5/setupdialog.py", line 709, in showAddPrinterPage
self.findPrinterPPD()
File "/usr/share/hplip/ui5/setupdialog.py", line 798, in findPrinterPPD
self.print_ppd = cups.getPPDFile2(
^^^^^^^^^^^^^^^^^
File "/usr/share/hplip/prnt/cups.py", line 540, in getPPDFile2
family_class=getFamilyClassName(model)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/hplip/prnt/cups.py", line 178, in getFamilyClassName
dict=m.read_all_files(False)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/hplip/base/models.py", line 456, in read_all_files
self.read_section(self.released_dat)
File "/usr/share/hplip/base/models.py", line 487, in read_section
line = fd.readline()
^^^^^^^^^^^^^
File "/usr/lib64/python3.11/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 913: ordinal not in range(128)
Aborted
but patching /usr/share/hplip/base/models.py:481 to force UTF-8 lets me at least add the printer. I'm assuming something in my environment is telling python my default encoding is ASCII? Interested to know what the correct fix would be...
I look forward to Pat could see this issue and providing a solution.
I do not own a working HP printer and will never buy another one. So I'm probably not the one to fix it (I did try to see if I could reproduce the issue here, but could not).
I do not own a working HP printer and will never buy another one. So I'm probably not the one to fix it (I did try to see if I could reproduce the issue here, but could not).
HP Linux Imaging and Printing System (ver. 3.23.12)
Printer/Fax Setup Utility ver. 9.0
Copyright (c) 2001-18 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.
Searching... (bus=net, timeout=5, ttl=4, search=(None) desc=0, method=mdns)
Traceback (most recent call last):
File "/usr/share/hplip/ui5/setupdialog.py", line 1395, in NextButton_clicked
self.showAddPrinterPage()
File "/usr/share/hplip/ui5/setupdialog.py", line 709, in showAddPrinterPage
self.findPrinterPPD()
File "/usr/share/hplip/ui5/setupdialog.py", line 790, in findPrinterPPD
ppdName = cups.getPpdName(self.model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/hplip/prnt/cups.py", line 196, in getPpdName
dict=m.read_all_files(False)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/share/hplip/base/models.py", line 456, in read_all_files
self.read_section(self.released_dat)
File "/usr/share/hplip/base/models.py", line 487, in read_section
line = fd.readline()
^^^^^^^^^^^^^
File "/usr/lib64/python3.11/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 913: ordinal not in range(128)
fish: Job 1, 'hp-setup' terminated by signal SIGABRT (Abort)
Looks like there is a single non-ascii character in /usr/share/hplip/data/models/models.dat (looks like a unicode space https://unicodeplus.com/U+2002)
Code:
diff -u /usr/share/hplip/data/models/models.dat.orig /usr/share/hplip/data/models/models.dat in bash at 10:26:11
--- /usr/share/hplip/data/models/models.dat.orig 2024-04-28 10:23:49.885064906 -0400
+++ /usr/share/hplip/data/models/models.dat 2024-04-28 10:25:10.436847862 -0400
@@ -78088,7 +78088,7 @@
io-support=14
job-storage=0
linefeed-cal-type=0
-model1=HP Color LaserJet Enterprise MFP X58045dn
+model1=HP Color LaserJet Enterprise MFP X58045dn
model2=HP Color LaserJet Enterprise MFP X58045
monitor-type=0
panel-check-type=0
If I remove it, everything also seems to work fine, but I have no idea if that will break other things for the long suffering HP users
I'd think any impact would be limited to people with a HP Color LaserJet Enterprise MFP X58045dn, but who knows.
Last edited by pdags; 04-28-2024 at 10:07 AM.
Reason: Adding some more context
Looking at the output of locale in post#9, there are a couple of oddities:
LC_TIME=en_GB.UTF-8 when I would expect LC_TIME="en_US.UTF-8" and
LC_TELEPHONE=zh_CN.UTF-8 when I would expect LC_TELEPHONE="en_US.UTF-8".
The screenshot shows the fish shell running in a konsole window. Is the output from locale run in konsole the same? Apparently the fish shell expects to be passed those variables.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.