parseQueues in base/queues.py parses 'lpstat -v' output incorrectly, leading to traceback
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
HPLIP |
New
|
Undecided
|
Unassigned | ||
hplip (Fedora) |
Fix Released
|
Undecided
|
Bug Description
If you call 'hp-diagnose_
$ hp-diagnose_queues
HP Linux Imaging and Printing System (ver. 3.23.5)
AutoConfig Utility to check queues configuration ver. 1.1
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.
QSocketNotifier: Can only be used with threads started with QThread
qt.qpa.
Traceback (most recent call last):
File "/usr/bin/
queues.
File "/usr/share/
mapofDevice
File "/usr/share/
if device_
AttributeError: 'NoneType' object has no attribute 'startswith'
It happens because the LPSTAT_PATTERN fails to parse the 'lpstat -v' output correctly. The output looks f.e. like this:
$ lpstat -v
device for test: socket:
and the LPSTAT_PATTERN is defined as this regexp:
LPSTAT_PATTERN = re.compile(
, so the requested URI is in 3rd matched group, not in the second as parseQueues() tries.
I've written a patch which fixes the issue, it is attached.
This issue was introduced in 3.22.10, where lpstat pattern changed.
Changed in hplip (Fedora): | |
importance: | Unknown → Undecided |
status: | Unknown → Fix Released |
Description of problem:
Not Load xsane app
and error for the scan paper
Version-Release number of selected component: 22.10-4. fc38
hplip-3.
Additional info: 300.fc38. x86_64 hp-diagnose_ queues --gui slice/user- 1000.slice/ user@1000. service/ app.slice/ app-gnome- hplip-58280. scope py:115: parseQueues: AttributeError: 'NoneType' object has no attribute 'startswith' hp-diagnose_ queues 22.10-4. fc38 3.11.2- 1.fc38. x86_64
reporter: libreport-2.17.9
kernel: 6.2.11-
cmdline: /usr/bin/python3 /usr/bin/
cgroup: 0::/user.
uid: 1000
reason: queues.
executable: /usr/bin/
type: Python3
package: hplip-3.
runlevel: N 5
exception_type: AttributeError
crash_function: parseQueues
interpreter: python3-
Truncated backtrace: py:115: parseQueues: AttributeError: 'NoneType' object has no attribute 'startswith'
queues.
Traceback (most recent call last): hp-diagnose_ queues" , line 120, in <module> main_function( passwordObj, mode,ui_toolkit, quiet_mode ) hplip/base/ queues. py", line 385, in main_function s,status = parseQueues(mode)
^^ ^^^^^^^ ^^^^^^^ ^ hplip/base/ queues. py", line 115, in parseQueues uri.startswith( "cups-pdf: /"):
^^^^^^^ ^^^^^^^ ^^^^^^^
File "/usr/bin/
queues.
File "/usr/share/
mapofDevice
File "/usr/share/
if device_
AttributeError: 'NoneType' object has no attribute 'startswith'
Local variables in innermost frame: installed: True Pro_MFP_ M127fn: hp:/usb/ HP_LaserJet_ Pro_MFP_ M127fn? serial= CNB9G9B4P8\ r\ndevice for HP_LaserJet_ Pro_MFP_ M127fn- JAVID: hp:/usb/ HP_LaserJet_ Pro_MFP_ M127fn? serial= CNB9G9B4P8\ r\ndevice for HP_LaserJet_ Pro_MFP_ M127fn_ fax: hpfax:/ usb/HP_ LaserJet_ Pro_MFP_ M127fn? serial= CNB9G9B4P8\ r\ndevice for HP_LaserJet_ Pro_MFP_ M127fn_ fax-JAVID: hpfax:/ usb/HP_ LaserJet_ Pro_MFP_ M127fn? serial= CNB9G9B4P8\ r\n' Pro_MFP_ M127fn' , None), ('HP_LaserJet_ Pro_MFP_ M127fn- JAVID', None), ('HP_LaserJet_ Pro_MFP_ M127fn_ fax', None), ('HP_LaserJet_ Pro_MFP_ M127fn_ fax-JAVID' , None)] Pro_MFP_ M127fn' , None) HP_LaserJet_ Pro_MFP_ M127fn_ fax-JAVID: hpfax:/usb/> Pro_MFP_ M127fn'
mode: 1
is_hpcups_
is_hpijs_installed: False
st: 0
output: 'device for HP_LaserJet_
status: True
cups_printers: [('HP_LaserJet_
p: ('HP_LaserJet_
match: <re.Match object; span=(11, 104), match='
printer_name: 'HP_LaserJet_
device_uri: None