Fix python crash if python 3.8 "distro" module is missing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
HPLIP |
New
|
Undecided
|
Unassigned |
Bug Description
hp-toolbox crashes with python 3.8 is used and the python "distro" module is unavailable.
$ hp-toolbox
HP Linux Imaging and Printing System (ver. 3.19.12)
HP Device Manager ver. 15.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.
Traceback (most recent call last):
File "/usr/share/
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/
toolbox = ui.DevMgr5(
File "/usr/share/
core = CoreInstall(
File "/usr/share/
self.
File "/usr/share/
self.
File "/usr/share/
distro_name = get_distro_
File "/usr/share/
import distro
ModuleNotFoundE
This crash can be easily avoided by catching the respective Exception. Both password.py and core_install.py contain existing code to determine the distro via "lsb_release" if the python mechanism fails.
This happens to me too still with version 3.20.11 in ubuntu 20.04. The command hp-plugin crashes too. The patch does not help me, but reading the previous comment I removed completely the distro sections and then it works by using the fallback mecanism. I attach the patch. To use it: evitar_ usar_platform. patch
hplip-3.20.11.run --noexec
cd hplip-3.20.11
patch -p1 < «path to patch»/
./hplip-install
If you already have hplip installed you can still use this patch. You only have to cd to /usr/share/hplip and then run the patch command above as root.