hp-check crashes with FileNotFoundError using python3.7

Bug #1802941 reported by zdohnal
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
Fix Released
Undecided
Unassigned

Bug Description

Hi,

we have reports on Fedora 29 (like https://bugzilla.redhat.com/show_bug.cgi?id=1645815 ) , where running of hp-check ends with (when the file the script is looking for isn't installed):

Traceback (most recent call last):
  File "/usr/share/hplip/base/utils.py", line 266, in walkFiles
    names = os.listdir(root)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/include/cups'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/hplip/base/utils.py", line 268, in walkFiles
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/bin/hp-check", line 861, in <module>
    dep.core.init()
  File "/usr/share/hplip/installer/core_install.py", line 500, in init
    self.check_dependencies(callback)
  File "/usr/share/hplip/installer/core_install.py", line 593, in check_dependencies
    self.have_dependencies[d] = self.dependencies[d][3]()
  File "/usr/share/hplip/installer/core_install.py", line 1139, in check_cups_image
    return check_file("raster.h", "/usr/include/cups")
  File "/usr/share/hplip/installer/dcheck.py", line 108, in check_file
    for w in utils.walkFiles(dir, recurse=True, abs_paths=True, return_folders=False, pattern=f):
RuntimeError: generator raised StopIteration

It is caused by python-3.7 change https://www.python.org/dev/peps/pep-0479/ , which changes behavior of StopIteration exception in generators. I'm not sure how many generators are affected by the change, but the attached patch fixes the issue for hp-check script.

Would you mind adding it into hplip project?

Best regards,

Zdenek Dohnal
Fedora/RHEL hplip maintainer

Tags: patch
Revision history for this message
zdohnal (zdohnal) wrote :
Revision history for this message
Santhosh Manchikanti (santhosh2357651) wrote :

Thanks Dohnal,,

Will add it in next release

Regards,
Santhosh

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