hp-toolbox tracebacks with Python3.10

Bug #1948801 reported by zdohnal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
Fix Released
Undecided
Unassigned
hplip (Fedora)
Fix Committed
Undecided

Bug Description

Hi,

we have the bug for Fedora 35 (https://bugzilla.redhat.com/show_bug.cgi?id=2015428) which has Python 3.10. The new Python introduced several changes which cause tracebacks in hp-toolbox (more info in the bugzilla link).

The first traceback is caused that 'collections.Callable' is now 'collections.abc.Callable', the latter is because now Python doesn't accept decimals, fractions and other objects as integer arguments without explicit conversion, because such objects can be converted to integer only with a loss.

Tags: patch
Revision history for this message
In , yalterz (yalterz-redhat-bugs) wrote :

Description of problem:
hp-toolbox crashes when trying to do certain things.

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

How reproducible:
Always

Steps to Reproduce:
1. Open hp-toolbox
2. Click on "Clean Printheads"

Actual results:
\Traceback (most recent call last):
  File "/usr/share/hplip/ui5/devmgr5.py", line 1270, in ActionsList_clicked
    if item.cmd and isinstance(item.cmd, collections.Callable):
AttributeError: module 'collections' has no attribute 'Callable'
Aborted (core dumped)

Expected results:
It opens hp-clean.

Steps to Reproduce:
1. Open hp-toolbox
2. Click on "Supplies"

Actual results:
\Traceback (most recent call last):
  File "/usr/share/hplip/ui5/devmgr5.py", line 567, in Tabs_currentChanged
    self.TabIndex[tab]()
  File "/usr/share/hplip/ui5/devmgr5.py", line 1575, in updateSuppliesTab
    level_pixmap = self.createStatusLevelGraphic(agent_level, agent_type)
  File "/usr/share/hplip/ui5/devmgr5.py", line 1706, in createStatusLevelGraphic
    pp.fillRect(0, 0, fw, h, QBrush(QColor(map[0])))
TypeError: arguments did not match any overloaded call:
  fillRect(self, QRectF, Union[QBrush, QColor, Qt.GlobalColor, QGradient]): argument 1 has unexpected type 'int'
  fillRect(self, QRect, Union[QBrush, QColor, Qt.GlobalColor, QGradient]): argument 1 has unexpected type 'int'
  fillRect(self, int, int, int, int, Union[QBrush, QColor, Qt.GlobalColor, QGradient]): argument 3 has unexpected type 'float'
  fillRect(self, QRectF, Union[QColor, Qt.GlobalColor, QGradient]): argument 1 has unexpected type 'int'
  fillRect(self, QRect, Union[QColor, Qt.GlobalColor, QGradient]): argument 1 has unexpected type 'int'
  fillRect(self, int, int, int, int, Union[QColor, Qt.GlobalColor, QGradient]): argument 3 has unexpected type 'float'
  fillRect(self, int, int, int, int, Qt.GlobalColor): argument 3 has unexpected type 'float'
  fillRect(self, QRect, Qt.GlobalColor): argument 1 has unexpected type 'int'
  fillRect(self, QRectF, Qt.GlobalColor): argument 1 has unexpected type 'int'
  fillRect(self, int, int, int, int, Qt.BrushStyle): argument 3 has unexpected type 'float'
  fillRect(self, QRect, Qt.BrushStyle): argument 1 has unexpected type 'int'
  fillRect(self, QRectF, Qt.BrushStyle): argument 1 has unexpected type 'int'
  fillRect(self, int, int, int, int, QGradient.Preset): argument 3 has unexpected type 'float'
  fillRect(self, QRect, QGradient.Preset): argument 1 has unexpected type 'int'
  fillRect(self, QRectF, QGradient.Preset): argument 1 has unexpected type 'int'
Aborted (core dumped)

Expected results:
It opens the supplies tab.

I'm running this on Fedora 35 Silverblue in an F35 toolbox.

Revision history for this message
In , zdohnal (zdohnal-redhat-bugs) wrote :

Hi Ivan,

thank you for reporting the issue!

Both issues are due Python 3.10 changes.

The former traceback is because 'Callable' is now under one more class, 'abc', so the correct call is now 'collections.abc.Callable'.

The latter is due Python3.10 stopped doing implicit format conversions to formats which can cause data loses (usually conversions from bigger formats to smaller - float -> int).

Would you mind trying the rpms from the scratch build and see if it helps? https://koji.fedoraproject.org/koji/taskinfo?taskID=77793063

Revision history for this message
In , yalterz (yalterz-redhat-bugs) wrote :

That build seems to work, thanks.

Revision history for this message
zdohnal (zdohnal) wrote :
Revision history for this message
zdohnal (zdohnal) wrote :

The fix for float2int conversions.

Revision history for this message
In , updates (updates-redhat-bugs) wrote :

FEDORA-2021-d068beec13 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2021-d068beec13

Revision history for this message
In , updates (updates-redhat-bugs) wrote :

FEDORA-2021-e985cbc01b has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-e985cbc01b

Revision history for this message
In , updates (updates-redhat-bugs) wrote :

FEDORA-2021-40a2896b2a has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-40a2896b2a

Revision history for this message
In , updates (updates-redhat-bugs) wrote :

FEDORA-2021-d068beec13 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-d068beec13`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-d068beec13

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

Revision history for this message
In , updates (updates-redhat-bugs) wrote :

FEDORA-2021-40a2896b2a has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-40a2896b2a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-40a2896b2a

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

Revision history for this message
In , updates (updates-redhat-bugs) wrote :

FEDORA-2021-e985cbc01b 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-e985cbc01b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-e985cbc01b

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

Changed in hplip (Fedora):
importance: Unknown → Undecided
status: Unknown → Fix Committed
Revision history for this message
zdohnal (zdohnal) wrote :

3.21.12 fixed the issue for ui5/devmgr.py, but the issue still stands in base/exif.py.

Changed in hplip:
status: New → In Progress
Revision history for this message
Shashank Kimothi (kim0-hplip) wrote :

Fix released in HPLIP-3.22.4

Changed in hplip:
status: In Progress → Fix Committed
status: Fix Committed → Fix Released
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.