LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   slackware-current: hp-setup from hplip-3.23.12-x86_64-4 throws UnicodeDecodeError after selecting printer (https://www.linuxquestions.org/questions/slackware-14/slackware-current-hp-setup-from-hplip-3-23-12-x86_64-4-throws-unicodedecodeerror-after-selecting-printer-4175736494/)

Petri Kaukasoina 04-28-2024 11:25 AM

Quote:

Originally Posted by allend (Post 6498701)
LC_TIME=en_GB.UTF-8 when I would expect LC_TIME="en_US.UTF-8"

There is a small change in the order between different English locales:
Code:

$ LC_TIME=en_GB.UTF-8 date
Sun 28 Apr 19:20:58 EEST 2024
$ LC_TIME=en_US.UTF-8 date
Sun Apr 28 19:20:59 EEST 2024
$ LC_TIME=en_AU.UTF-8 date
Sun 28 Apr 2024 19:21:00 EEST


zalois 04-29-2024 05:59 PM

5 Attachment(s)
Attachment 42749

Attachment 42750

Attachment 42751

Attachment 42752

Attachment 42753
I have used this recent update, but I am only able to complete the process of adding a printer. The printer is still not in the list and cannot be used.

zalois 04-29-2024 06:01 PM

1 Attachment(s)
Quote:

Originally Posted by zalois (Post 6498924)
Attachment 42749

Attachment 42750

Attachment 42751

Attachment 42752

Attachment 42753
I have used this recent update, but I am only able to complete the process of adding a printer. The printer is still not in the list and cannot be used.

Attachment 42754

pdags 04-30-2024 09:03 AM

I think HP is screwing with the locale somewhere, which is big no-no if that's whats happening. You should be able to work around it by running the setup utility from a shell and explicitly setting LC_CTYPE to 'C' or 'POSIX':

Code:

$ LC_CTYPE=POSIX hp-setup
you can also skip the GUI nonsense and run interactive with

Code:

$ LC_CTYPE=POSIX hp-setup -i
If the printer is added successfully you should see it in the CUPS webUI: http://localhost:631/printers/?

I sort of suspect the real fix is to either:
  • change the generated models.dat file to only have ASCII characters. AFAIK HP are the ones distributing it, so if it should be ASCII then they should ensure there are no non-ascii characters in there.
  • or if models.dat is allowed to have non-ascii characters, they should open the file properly to begin with instead of relying on the default, platform dependent, open behavior.

But I'm not a python guy, and character encoding is right up there with handling time correctly in things I hate dealing with, so I'm :confused:.

TL;DR I can live with this workaround, but YMMV.

zalois 04-30-2024 10:05 AM

Quote:

Originally Posted by pdags (Post 6499059)
I think HP is screwing with the locale somewhere, which is big no-no if that's whats happening. You should be able to work around it by running the setup utility from a shell and explicitly setting LC_CTYPE to 'C' or 'POSIX':

Code:

$ LC_CTYPE=POSIX hp-setup
you can also skip the GUI nonsense and run interactive with

Code:

$ LC_CTYPE=POSIX hp-setup -i
If the printer is added successfully you should see it in the CUPS webUI: http://localhost:631/printers/?

I sort of suspect the real fix is to either:
  • change the generated models.dat file to only have ASCII characters. AFAIK HP are the ones distributing it, so if it should be ASCII then they should ensure there are no non-ascii characters in there.
  • or if models.dat is allowed to have non-ascii characters, they should open the file properly to begin with instead of relying on the default, platform dependent, open behavior.

But I'm not a python guy, and character encoding is right up there with handling time correctly in things I hate dealing with, so I'm :confused:.

TL;DR I can live with this workaround, but YMMV.


I used your code, but still did not succeed.

pdags 05-01-2024 07:27 AM

Weird. You could try to reinstall hplip to make sure nothing is in a bad state. As root,
Code:

slackpkg reinstall hplip
?

What's the output if you don't use the gui?

Code:

hp-setup -i -bnet
What does lpstat show?
Code:

lpstat -t
Failing all that, I wouldn't bother messing with hplip. Just add the printer through CUPS directly through the web UI usually found at http://localhost:631

pdags 05-01-2024 07:39 AM

Alternatively, consider driverless printing https://wiki.debian.org/CUPSDriverlessPrinting

To find the URIs, as my user:
Code:

$ driverless
ipps://HP%20OfficeJet%20Pro%209010%20series%20%5BFA8F40%5D._ipps._tcp.local/
$ ippfind
ipp://gutenberg1.local:631/ipp/print

As root, add the print queue:
Code:

# lpadmin -p HP_OfficeJet_Pro_9010 -v ipp://gutenberg1.local:631/ipp/print -E -m everywhere
As my user again, check the printer staus:
Code:

$ lpstat -t                                                                                                                                                          in bash at 08:23:44
scheduler is running
system default destination: HP_OfficeJet_Pro_9010
device for HP_OfficeJet_Pro_9010: ipp://gutenberg1.local:631/ipp/print
HP_OfficeJet_Pro_9010 accepting requests since Wed 01 May 2024 08:24:47 AM EDT
printer HP_OfficeJet_Pro_9010 is idle.  enabled since Wed 01 May 2024 08:24:47 AM EDT

And done. Printer shows up in CUPS, System Settings->Printers, etc. Seems a lot simpler than messing with drivers and PPDs.

zalois 05-01-2024 07:34 PM

Quote:

Originally Posted by pdags (Post 6499253)
Weird. You could try to reinstall hplip to make sure nothing is in a bad state. As root,
Code:

slackpkg reinstall hplip
?

What's the output if you don't use the gui?

Code:

hp-setup -i -bnet
What does lpstat show?
Code:

lpstat -t
Failing all that, I wouldn't bother messing with hplip. Just add the printer through CUPS directly through the web UI usually found at http://localhost:631






Thank you very much, i'll try your plan.

pdags 05-02-2024 06:23 AM

Quote:

Originally Posted by zalois (Post 6499385)
Thank you very much, i'll try your plan.

Make sure you update before you reinstall. Looks like there is a new build of hplip available https://git.slackware.nl/current/com...15e355bf512059 and now that I've run my mouth for so long I'm dying to know if it actually fixes the issue for anyone besides me ;)

zalois 05-02-2024 08:42 PM

Quote:

Originally Posted by pdags (Post 6499444)
Make sure you update before you reinstall. Looks like there is a new build of hplip available https://git.slackware.nl/current/com...15e355bf512059 and now that I've run my mouth for so long I'm dying to know if it actually fixes the issue for anyone besides me ;)


Thank you for generously sharing your findings. I will try my best to solve this problem.


All times are GMT -5. The time now is 02:44 PM.