threading.Thread.isAlive() is removed in python3.9 - use threading.Thread.is_alive()

Bug #1889280 reported by zdohnal
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
HPLIP
Fix Released
Undecided
Unassigned
Fedora
Unknown
Undecided

Bug Description

Hi,

python3.9 removed a deprecated method of threading.Thread object - isAlive(). The new function is is_alive().

hp-scan (and probably copy and fax tools too, because they use the removed method too, but I didn't test those) tracebacks without the attached patch.

Traceback is in Fedora bug.

Would you mind adding the patch to HPLIP project?

Thank you in advance and have a nice day,

Zdenek Dohnal
RHEL/CentOS/Fedora hplip maintainer

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

Description of problem:

trying to scan a document with hp-scan I get the following traceback

Page 1: Scanning...
Closing device.
Traceback (most recent call last):
  File "/usr/bin/hp-scan", line 1315, in <module>
    device.waitForScanActive()
  File "/usr/share/hplip/scan/sane.py", line 403, in waitForScanActive
    if self.scan_thread.isAlive() and \
AttributeError: 'ScanThread' object has no attribute 'isAlive'

Version-Release number of selected component (if applicable):
hplip-3.20.6-1.fc33.x86_64

How reproducible:
always

Steps to Reproduce:
1. hp-scan --adf -o out.pdf -d hpaio:/net/HP_Color_LaserJet_MFP_M277dw?ip=x.x.x.x -m lineart
2.
3.

Actual results:

Expected results:

Additional info:

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

Hi Dennis,

thank you for reporting the issue!

Python3.9 removed isAlive() method from threading.Thread module, replaced by is_alive().

I'll check if I can reproduce with hp-scan and my HP device, otherwise I would like you to check the fix.

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

Yep, I'm able to reproduce with my model.

Revision history for this message
zdohnal (zdohnal) wrote :
Revision history for this message
In , zdohnal (zdohnal-redhat-bugs) wrote :
Changed in fedora:
importance: Unknown → Undecided
Revision history for this message
In , zdohnal (zdohnal-redhat-bugs) wrote :

I'm not able to build hplip at the moment because configure script is not able to find out net-snmp. I alerted net-snmp maintainer about the issue and we will look into it.

Revision history for this message
emk2203 (emk2203) wrote :

This error persists in Hirsute 21.04, checked on 2020-12-09.

Quick fix for everyone affected until this is sorted out:

```bash
sudo sed -i 's/isAlive()/is_alive()/gc /usr/share/hplip/*/{copier.py,fax.py,pmlfax.py,sane.py}
```

This should work on all installed `hplip` versions, including the current 3.20.11+dfsg0-1.

You can confirm during the operation and double-check with @zdohnal's proposed patch [here](https://bugs.launchpad.net/hplip/+bug/1889280/comments/1).

Revision history for this message
emk2203 (emk2203) wrote :

Forgot a closing quote, and confirmation doesn't work with sed. So, it needs to be

    sudo sed -i 's/isAlive()/is_alive()/g' /usr/share/hplip/*/{copier.py,fax.py,pmlfax.py,sane.py}

Revision history for this message
sivakumar (kavinsivak) wrote :

Fix released in 3.21.4

Changed in hplip:
status: New → 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.