Python exceptions in plugin installation in hplip-3.20.9 & linux mint

Bug #1899264 reported by Dominique PAUL
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
HPLIP
In Progress
Undecided
Unassigned

Bug Description

Hello,

Problem
hp-plugin command aborts because several python exceptions.
I use workaround.

Environment
hplip-3.20.9
linux mint 20, in a virtualbox
HP Deskjet 2700 series

Workaround
Instead of hp-plugin command, I use "sh hplip-3.20.9-plugin.run".
(Thank you shivani mandora)

-----------------------------------------------------------------------------------------
Logs of "hp-plugin -i -g -p hplip-3.20.9-plugin.run"

HP Linux Imaging and Printing System (ver. 3.20.9)
Plugin Download and Install Utility ver. 2.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.

HP Linux Imaging and Printing System (ver. 3.20.9)
Plugin Download and Install Utility ver. 2.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.

hp-plugin[2530]: debug: Locking: /home/dominique/.hplip/hp-plugin.lock
hp-plugin[2530]: debug: Unable to open file /var/lib/hp/hplip.state for reading.
hp-plugin[2530]: debug: Unable to open file /var/lib/hp/hplip.state for reading.
(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)

-----------------------------------------
| PLUG-IN INSTALLATION FOR HPLIP 3.20.9 |
-----------------------------------------

---------------
| COPY PLUGIN |
---------------

Downloading plug-in from: file:///home/dominique/Téléchargements/hplip-3.20.9-linuxmint/hplip-3.20.9-plugin.run
Downloading plug-in: [\ ] 0% Traceback (most recent call last):
  File "/usr/share/hplip/base/password.py", line 85, in get_distro_name
    os_name = platform.dist()[0]
AttributeError: module 'platform' has no attribute 'dist'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/hp-plugin", line 363, in <module>
    status, plugin_path, error_str = pluginObj.download(plugin_path, plugin_download_callback)
  File "/usr/share/hplip/installer/pluginhandler.py", line 254, in download
    core = core_install.CoreInstall()
  File "/usr/share/hplip/installer/core_install.py", line 241, in __init__
    self.passwordObj = password.Password(ui_mode)
  File "/usr/share/hplip/base/password.py", line 118, in __init__
    self.__readAuthType() # self.__authType
  File "/usr/share/hplip/base/password.py", line 141, in __readAuthType
    distro_name = get_distro_name().lower().replace(" ","")
  File "/usr/share/hplip/base/password.py", line 88, in get_distro_name
    os_name = distro.linux_distribution()[0]
  File "/usr/lib/python3/dist-packages/distro.py", line 122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/lib/python3/dist-packages/distro.py", line 677, in linux_distribution
    self.version(),
  File "/usr/lib/python3/dist-packages/distro.py", line 737, in version
    self.lsb_release_attr('release'),
  File "/usr/lib/python3/dist-packages/distro.py", line 899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/lib/python3/dist-packages/distro.py", line 552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/lib/python3/dist-packages/distro.py", line 1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_share_hplip_plugin.py.1000.crash'

Original exception was:
Traceback (most recent call last):
  File "/usr/share/hplip/base/password.py", line 85, in get_distro_name
    os_name = platform.dist()[0]
AttributeError: module 'platform' has no attribute 'dist'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/hp-plugin", line 363, in <module>
    status, plugin_path, error_str = pluginObj.download(plugin_path, plugin_download_callback)
  File "/usr/share/hplip/installer/pluginhandler.py", line 254, in download
    core = core_install.CoreInstall()
  File "/usr/share/hplip/installer/core_install.py", line 241, in __init__
    self.passwordObj = password.Password(ui_mode)
  File "/usr/share/hplip/base/password.py", line 118, in __init__
    self.__readAuthType() # self.__authType
  File "/usr/share/hplip/base/password.py", line 141, in __readAuthType
    distro_name = get_distro_name().lower().replace(" ","")
  File "/usr/share/hplip/base/password.py", line 88, in get_distro_name
    os_name = distro.linux_distribution()[0]
  File "/usr/lib/python3/dist-packages/distro.py", line 122, in linux_distribution
    return _distro.linux_distribution(full_distribution_name)
  File "/usr/lib/python3/dist-packages/distro.py", line 677, in linux_distribution
    self.version(),
  File "/usr/lib/python3/dist-packages/distro.py", line 737, in version
    self.lsb_release_attr('release'),
  File "/usr/lib/python3/dist-packages/distro.py", line 899, in lsb_release_attr
    return self._lsb_release_info.get(attribute, '')
  File "/usr/lib/python3/dist-packages/distro.py", line 552, in __get__
    ret = obj.__dict__[self._fname] = self._f(obj)
  File "/usr/lib/python3/dist-packages/distro.py", line 1012, in _lsb_release_info
    stdout = subprocess.check_output(cmd, stderr=devnull)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

-----------------------------------------------------------------------------------------
Steps to recreate the problems

- create a vbox; take care of usb filter
- install linux mint 20 xfce in the vbox
- verify usb
-- plug the printer, power on the printer
-- type "lsusb", the printer must be in the list

- uninstall the linux mint hplip 3.20.03:
-- sudo apt-get purge hplip hplip-data hplip-doc hplip-gui hpijs-ppds libsane-hpaio libhpmud0 printer-driver-hpcups printer-driver-hpijs
-- sudo rm -rf /usr/share/hplip/
-- sudo apt-get autoremove

- download hplip 3.20.9, i.e.:
-- hplip-3.20.9-run
-- hplip-3.20.9-run.asc
-- hplip-3.20.9-plugin.run
-- hplip-3.20.9-plugin.run.asc
put them in a temporary directory, and do the gpg verifications

- in a terminal, execute hplip-3.20.9-run
-- when there is a question in the terminal, accept (tape enter), including on "RESTART OR RE-PLUG IS REQUIRED"
-- continue with the printer setup process.

- open HP Device Manager
-- in the "Actions" tab, there are only 3 actions: only Cups, Visit HPLIP Support Website & Help
-- there are errors lines on the terminal, including
error: Unable to communicate with device (code=12): hp:/usb/DeskJet_2700_series?serial=CN0773A4HK
error: Device not found
-- an error popup "HP Device Status" "DeskJet_2700_series Printer (CN0773A4HK)" "Device communication error (5012)"

- remove ippusbxd
-- sudo apt purge ippusbxd
-- lsusb
-- open HP Device Manager: no errors, and there is a normal list in the "Actions" tab
-- else, if communicate error remains, restart & retry

- install the plugin
-- getting a key from pgp.mit.edu can be very long; give preventively the key from another server:
/usr/bin/gpg --homedir /home/<user>/.hplip/.gnupg --no-permission-warning --keyserver pool.sks-keyservers.net --recv-keys 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9
-- in a terminal, from the temporary directory, type "hp-plugin -i -g -p hplip-3.20.9-plugin.run"
-- the command aborts
-- One can see the errors lines

Revision history for this message
shivani mandora (shivani1708) wrote :

Hi ,

We will try to fix traceback error on hp-plugin.

Meanwhile, Can you please install plugin using sh command:

$sh 3.20.9-plugin.run

This should not throw any traceback error.

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

Same problem in Linux Mint 20 (with latest updates)

Revision history for this message
Alberto Mardegan (mardy) wrote :

The installation script provided by HP also does not work:

===============
DEPENDENCY AND CONFLICT RESOLUTION
----------------------------------
Running 'sudo apt-get install --assume-yes gtk2-engines-pixbuf'
Please wait, this may take several minutes...
Running 'sudo apt-get install --assume-yes python-pyqt5'
Please wait, this may take several minutes...
error: Command failed. Re-try #1...
Running 'sudo apt-get install --assume-yes python-pyqt5'
Please wait, this may take several minutes...
error: Command failed. Re-try #2...
Running 'sudo apt-get install --assume-yes python-pyqt5'
Please wait, this may take several minutes...
error: Command failed. Re-try #3...
Running 'sudo apt-get install --assume-yes python-pyqt5'
Please wait, this may take several minutes...
error: Package install command failed with error code 100
Would you like to retry installing the missing package(s) (y=yes*, n=no, q=quit) ?
===============

There is no such a package (python-pyqt5) in Ubuntu 20.04.

Revision history for this message
Alberto Mardegan (mardy) wrote :

It looks like a python versioning issue. I could install the plugin by running this command:

    python3 /usr/bin/hp-plugin -i

Then, the hp-setup tool encountered another error:

=================
HP Linux Imaging and Printing System (ver. 3.20.3)
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=usb, search=(None), desc=0)
Traceback (most recent call last):
  File "/usr/share/hplip/ui5/setupdialog.py", line 1304, in NextButton_clicked
    self.showAddPrinterPage()
  File "/usr/share/hplip/ui5/setupdialog.py", line 710, in showAddPrinterPage
    self.findPrinterPPD()
  File "/usr/share/hplip/ui5/setupdialog.py", line 789, in findPrinterPPD
    self.print_ppd = cups.getPPDFile2(self.mq, self.model, self.ppds)
  File "/usr/share/hplip/prnt/cups.py", line 491, in getPPDFile2
    family_class=getFamilyClassName(model)
  File "/usr/share/hplip/prnt/cups.py", line 181, in getFamilyClassName
    family_type= dict[m]['family-class']
KeyError: 'family-class'

Done.
=================

This only seems to happen if the program is started with the gui. Running it in interactive mode did not cause any errors, and I could finally use my printer:

    python3 /usr/bin/hp-setup -i

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.