Skip to content

Commit

Permalink
Work with newer python3-rpm
Browse files Browse the repository at this point in the history
Fixes #22

Apparently newer python3-rpm versions now return str instead of bytes

Upstream says >= 4.15
but given this was reported shortly after switching to 4.16.1
this could also be newer.
  • Loading branch information
bmwiedemann committed Apr 24, 2021
1 parent 6c2d9f3 commit 9047b67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion handlers/bin/command-not-found
Expand Up @@ -79,7 +79,11 @@ def find_package_by_file(term):
ts = rpm.TransactionSet()
mi = ts.dbMatch('basenames', term)
try:
return next(mi)['name'].decode()
ret = next(mi)['name']
if isinstance(ret, str):
return ret
else:
return ret.decode()
except StopIteration:
return None

Expand Down

0 comments on commit 9047b67

Please sign in to comment.