* Trouble setting up hplip and cups - printer ppd fails
@ 2016-12-24 13:56 ng0
2016-12-24 14:08 ` ng0
0 siblings, 1 reply; 5+ messages in thread
From: ng0 @ 2016-12-24 13:56 UTC (permalink / raw)
To: guix-devel
I'm having a hard time getting hplip and cups to recognize the
PPD for my printer (one of those which are not network enabled,
which is why I feel safe enough sharing the model and serial
numbers here).
Starting at https://gnunet.org/bot/log/guix/2016-12-24#T1240133
you can find the discussion adfeno and myself had about the
problem.
In addition to the output below, my user is member of lp and
lpadmin and cups webinterface complains about hpcups if I add the
printer through cups (which you should not do with HP, at least I
was told so in the past and learned that this printer does not
work with cups pdds but with hplip ppds it works):
Idle - "File "/gnu/store/pd200v2q8vdxy6ycsxjsskxavc5q2jvk-cups-server-bin/lib/cups/filter/hpcups" not available: No such file or directory"
I never was a fan of the terminal setup they have, so I'll try to
add the Qt interface next week. But this doesn't seem like the
problem here.
ng0@wasp ~$ sudo hp-setup -a -g -i
HP Linux Imaging and Printing System (ver. 3.16.11)
Printer/Fax Setup Utility ver. 9.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.
hp-setup[9475]: debug: param=
hp-setup[9475]: debug: selected_device_name=None
Using connection type: usb
hp-setup[9475]: debug:
DEVICE CHOOSER setup_fax=True, setup_print=True
hp-setup[9475]: debug: Cache miss: deskjet_2510_series
hp-setup[9475]: debug: Reading file: /gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/data/models/models.dat
hp-setup[9475]: debug: Searching for section [deskjet_2510_series] in file /gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/data/models/models.dat
hp-setup[9475]: debug: Found section [deskjet_2510_series] in file /gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/data/models/models.dat
hp-setup[9475]: debug: getDeviceUri(None, None, ('hp',), None, , True)
hp-setup[9475]: debug: Mode=0
Setting up device: hp:/usb/Deskjet_2510_series?serial=CN2A63NGG305QX
hp-setup[9475]: debug: Model=Deskjet_2510_series
hp-setup[9475]: debug: (CUPS 1.2.x) Getting list of PPDs using CUPS_GET_PPDS...
hp-setup[9475]: debug: CUPS PPD base path = /gnu/store/29ik1f5fmx9pbcrz0mmcw1hy62cwqrjg-cups-minimal-2.2.1/share/cups/model
hp-setup[9475]: debug: Foomatic PPD base path = /gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/ppd
hp-setup[9475]: debug: Exception: 4 (Unknown/invalid device-uri field)
hp-setup[9475]: debug: Exception: 4 (Unknown/invalid device-uri field)
---------------------
| PRINT QUEUE SETUP |
---------------------
hp-setup[9475]: debug: Exception: 4 (Unknown/invalid device-uri field)
Using queue name: Deskjet_2510
Locating PPD file... Please wait.
hp-setup[9475]: debug: Matching PPD list to model deskjet_2510...
hp-setup[9475]: debug: []
hp-setup[9475]: debug: No PPD found for model deskjet_2510 using new algorithm. Trying old algorithm...
hp-setup[9475]: debug: 1st stage edit distance match
hp-setup[9475]: debug: Determining edit distance from deskjet_2510 (only showing edit distances < 4)...
hp-setup[9475]: debug: Min. dist = 9223372036854775807
hp-setup[9475]: debug: {}
hp-setup[9475]: debug: []
hp-setup[9475]: debug: []
error: No PPD found for model deskjet_2510 using old algorithm.
error: Unable to find an appropriate PPD file.
Would you like to specify the path to the correct PPD file to use (y=yes, n=no*, q=quit) ? y
Please enter the full filesystem path to the PPD file to use (q=quit) :/home/ng0/.guix-profile/share/ppd/HP/hp-deskjet_2510_series.ppd.gz
Traceback (most recent call last):
File "/gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/setup.py", line 560, in <module>
desc = nickname_pat.search(nickname).group(1)
TypeError: cannot use a string pattern on a bytes-like object
--
♥Ⓐ ng0
PGP keys and more: https://n0is.noblogs.org/ http://ng0.chaosnet.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trouble setting up hplip and cups - printer ppd fails
2016-12-24 13:56 Trouble setting up hplip and cups - printer ppd fails ng0
@ 2016-12-24 14:08 ` ng0
2016-12-24 15:23 ` Danny Milosavljevic
0 siblings, 1 reply; 5+ messages in thread
From: ng0 @ 2016-12-24 14:08 UTC (permalink / raw)
To: guix-devel
ng0 <ng0@libertad.pw> writes:
> I'm having a hard time getting hplip and cups to recognize the
> PPD for my printer (one of those which are not network enabled,
> which is why I feel safe enough sharing the model and serial
> numbers here).
> Starting at https://gnunet.org/bot/log/guix/2016-12-24#T1240133
> you can find the discussion adfeno and myself had about the
> problem.
>
> In addition to the output below, my user is member of lp and
> lpadmin and cups webinterface complains about hpcups if I add the
> printer through cups (which you should not do with HP, at least I
> was told so in the past and learned that this printer does not
> work with cups pdds but with hplip ppds it works):
> Idle - "File "/gnu/store/pd200v2q8vdxy6ycsxjsskxavc5q2jvk-cups-server-bin/lib/cups/filter/hpcups" not available: No such file or directory"
Actually when I use cups and not the hplip ppd file from within
cups webinterface, I get an error about color management, see log
of #guix further down.
> I never was a fan of the terminal setup they have, so I'll try to
> add the Qt interface next week. But this doesn't seem like the
> problem here.
>
> ng0@wasp ~$ sudo hp-setup -a -g -i
>
> HP Linux Imaging and Printing System (ver. 3.16.11)
> Printer/Fax Setup Utility ver. 9.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.
>
> hp-setup[9475]: debug: param=
> hp-setup[9475]: debug: selected_device_name=None
>
> Using connection type: usb
>
> hp-setup[9475]: debug:
> DEVICE CHOOSER setup_fax=True, setup_print=True
> hp-setup[9475]: debug: Cache miss: deskjet_2510_series
> hp-setup[9475]: debug: Reading file: /gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/data/models/models.dat
> hp-setup[9475]: debug: Searching for section [deskjet_2510_series] in file /gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/data/models/models.dat
> hp-setup[9475]: debug: Found section [deskjet_2510_series] in file /gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/data/models/models.dat
> hp-setup[9475]: debug: getDeviceUri(None, None, ('hp',), None, , True)
> hp-setup[9475]: debug: Mode=0
>
> Setting up device: hp:/usb/Deskjet_2510_series?serial=CN2A63NGG305QX
>
>
> hp-setup[9475]: debug: Model=Deskjet_2510_series
> hp-setup[9475]: debug: (CUPS 1.2.x) Getting list of PPDs using CUPS_GET_PPDS...
> hp-setup[9475]: debug: CUPS PPD base path = /gnu/store/29ik1f5fmx9pbcrz0mmcw1hy62cwqrjg-cups-minimal-2.2.1/share/cups/model
> hp-setup[9475]: debug: Foomatic PPD base path = /gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/ppd
> hp-setup[9475]: debug: Exception: 4 (Unknown/invalid device-uri field)
> hp-setup[9475]: debug: Exception: 4 (Unknown/invalid device-uri field)
>
> ---------------------
> | PRINT QUEUE SETUP |
> ---------------------
>
> hp-setup[9475]: debug: Exception: 4 (Unknown/invalid device-uri field)
> Using queue name: Deskjet_2510
> Locating PPD file... Please wait.
> hp-setup[9475]: debug: Matching PPD list to model deskjet_2510...
> hp-setup[9475]: debug: []
> hp-setup[9475]: debug: No PPD found for model deskjet_2510 using new algorithm. Trying old algorithm...
> hp-setup[9475]: debug: 1st stage edit distance match
> hp-setup[9475]: debug: Determining edit distance from deskjet_2510 (only showing edit distances < 4)...
> hp-setup[9475]: debug: Min. dist = 9223372036854775807
> hp-setup[9475]: debug: {}
> hp-setup[9475]: debug: []
> hp-setup[9475]: debug: []
> error: No PPD found for model deskjet_2510 using old algorithm.
> error: Unable to find an appropriate PPD file.
>
> Would you like to specify the path to the correct PPD file to use (y=yes, n=no*, q=quit) ? y
>
> Please enter the full filesystem path to the PPD file to use (q=quit) :/home/ng0/.guix-profile/share/ppd/HP/hp-deskjet_2510_series.ppd.gz
> Traceback (most recent call last):
> File "/gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/setup.py", line 560, in <module>
> desc = nickname_pat.search(nickname).group(1)
> TypeError: cannot use a string pattern on a bytes-like object
>
> --
> ♥Ⓐ ng0
> PGP keys and more: https://n0is.noblogs.org/ http://ng0.chaosnet.org
>
>
--
♥Ⓐ ng0
PGP keys and more: https://n0is.noblogs.org/ http://ng0.chaosnet.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trouble setting up hplip and cups - printer ppd fails
2016-12-24 14:08 ` ng0
@ 2016-12-24 15:23 ` Danny Milosavljevic
2016-12-29 22:12 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Danny Milosavljevic @ 2016-12-24 15:23 UTC (permalink / raw)
To: ng0; +Cc: guix-devel
Hi,
On Sat, 24 Dec 2016 14:08:44 +0000
ng0 <ng0@libertad.pw> wrote:
> > Traceback (most recent call last):
> > File "/gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/setup.py", line 560, in <module>
> > desc = nickname_pat.search(nickname).group(1)
> > TypeError: cannot use a string pattern on a bytes-like object
The reason that fails is because gzip.GzipFile always provides reads in binary mode. However, ppd files are not binary and nickname_pat is not binary either. So not sure what they were thinking...
if file_path.endswith('.gz'):
nickname = gzip.GzipFile(file_path, 'r').read(4096) # bytes, not str
else:
nickname = open(file_path, 'r').read(4096) # str
try:
desc = nickname_pat.search(nickname).group(1)
except AttributeError:
desc = ''
A quick fix would be to gunzip the ppd file and specify it without ".gz" in hp-setup. You don't need to patch anything for this.
A better fix with patching would be: Replacing
nickname = gzip.GzipFile(file_path, 'r').read(4096)
by
nickname = gzip.GzipFile(file_path, 'r').read(4096).decode("utf-8")
.
An even better fix would be to find out which parts are supposed to be binary and which are supposed to be text - use the correct functions accordingly and upstream it.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trouble setting up hplip and cups - printer ppd fails
2016-12-24 15:23 ` Danny Milosavljevic
@ 2016-12-29 22:12 ` Ludovic Courtès
2016-12-29 22:38 ` ng0
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2016-12-29 22:12 UTC (permalink / raw)
To: Danny Milosavljevic; +Cc: guix-devel
Hello!
Danny Milosavljevic <dannym@scratchpost.org> skribis:
> On Sat, 24 Dec 2016 14:08:44 +0000
> ng0 <ng0@libertad.pw> wrote:
>
>> > Traceback (most recent call last):
>> > File "/gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/setup.py", line 560, in <module>
>> > desc = nickname_pat.search(nickname).group(1)
>> > TypeError: cannot use a string pattern on a bytes-like object
>
> The reason that fails is because gzip.GzipFile always provides reads in binary mode. However, ppd files are not binary and nickname_pat is not binary either. So not sure what they were thinking...
Could it be that Python 3 support in hplip is incomplete? (ISTR that
Python 3 treats Unicode sequences differently compared to Python 2.)
The hplip recipe has this comment:
;; Python3 support is available starting from hplip@3.15.2.
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Trouble setting up hplip and cups - printer ppd fails
2016-12-29 22:12 ` Ludovic Courtès
@ 2016-12-29 22:38 ` ng0
0 siblings, 0 replies; 5+ messages in thread
From: ng0 @ 2016-12-29 22:38 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ludovic Courtès <ludo@gnu.org> writes:
> Hello!
>
> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>
>> On Sat, 24 Dec 2016 14:08:44 +0000
>> ng0 <ng0@libertad.pw> wrote:
>>
>>> > Traceback (most recent call last):
>>> > File "/gnu/store/95vp3r6n9z7s85achc7a0b8aay1k73qq-hplip-3.16.11/share/hplip/setup.py", line 560, in <module>
>>> > desc = nickname_pat.search(nickname).group(1)
>>> > TypeError: cannot use a string pattern on a bytes-like object
>>
>> The reason that fails is because gzip.GzipFile always provides reads in binary mode. However, ppd files are not binary and nickname_pat is not binary either. So not sure what they were thinking...
>
> Could it be that Python 3 support in hplip is incomplete? (ISTR that
> Python 3 treats Unicode sequences differently compared to Python 2.)
>
> The hplip recipe has this comment:
>
> ;; Python3 support is available starting from hplip@3.15.2.
>
> Ludo’.
It works in Gentoo with python3, so maybe their one patch on this
is not just cosmetic.
--
♥Ⓐ ng0
PGP keys and more: https://n0is.noblogs.org/ http://ng0.chaosnet.org
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-29 22:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-24 13:56 Trouble setting up hplip and cups - printer ppd fails ng0
2016-12-24 14:08 ` ng0
2016-12-24 15:23 ` Danny Milosavljevic
2016-12-29 22:12 ` Ludovic Courtès
2016-12-29 22:38 ` ng0
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.