Bug 2028697

Summary: hp-setup trackbacks when hplip-gui RPM is not installed
Product: [Fedora] Fedora Reporter: Peter Janes <bugzilla.redhat.com>
Component: hplipAssignee: Zdenek Dohnal <zdohnal>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: jridky, tkorbar, twaugh, zdohnal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hplip-3.21.2-15.fc35 hplip-3.21.2-15.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 02:06:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Peter Janes 2021-12-02 23:50:58 UTC
Description of problem:
hp-setup fails with a Python traceback, ending with "ModuleNotFoundError: No module named 'ui5'"


Version-Release number of selected component (if applicable):
hplip-3.21.2-13.fc35.x86_64

How reproducible: 100%


Steps to Reproduce:
1. Install hplip
2. Execute hp-setup
3.

Actual results:
$ hp-setup 

HP Linux Imaging and Printing System (ver. 3.21.2)
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.

Traceback (most recent call last):
  File "/usr/bin/hp-setup", line 313, in <module>
    ui = import_module(ui_package + ".setupdialog")
  File "/usr/lib64/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1004, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ui5'


Expected results:


Additional info:
Previous duplicates include bug 1368737, bug 1530331, bug 1794147; the latter (apparently fixed in Fedora 32) says it should report "error: Install the hplip-gui package for graphical support." but that doesn't happen.

Comment 1 Zdenek Dohnal 2021-12-03 07:07:10 UTC
Hi Peter,

thank you for reporting the issue!

HP tools uses import_dialog() function for checking for GUI. However the function lives in base/utils.py which is a different dir level than where ui5 module is, so the function uses indirect import like:

import ui5

which has a downside - IMO it looks everywhere in python module search path, so it can load other module than you expect - which happened this time. But of course this module doesn't have classes which HP script expects, so it fails later.

The proper fix would be to move the function to the same level as ui5 module, but since upstream is rarely responsive, I'll work it around by importing some class from ui5 module...

Comment 2 Zdenek Dohnal 2021-12-03 07:29:11 UTC
FYI the current hplip will show error message if hplip-gui is not installed and automatically switches to interactive mode.

Comment 3 Fedora Update System 2021-12-03 08:23:02 UTC
FEDORA-2021-08c10ee211 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-08c10ee211

Comment 4 Fedora Update System 2021-12-03 08:58:57 UTC
FEDORA-2021-ce9bb5d10b has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-ce9bb5d10b

Comment 5 Fedora Update System 2021-12-04 01:23:40 UTC
FEDORA-2021-08c10ee211 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-08c10ee211`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-08c10ee211

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2021-12-04 02:16:53 UTC
FEDORA-2021-ce9bb5d10b has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-ce9bb5d10b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-ce9bb5d10b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2021-12-07 02:06:18 UTC
FEDORA-2021-08c10ee211 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2021-12-12 01:05:01 UTC
FEDORA-2021-ce9bb5d10b has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.