2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 19:57:47 +00:00

Allow LookupError on decode

If a minimal Python distro does not have
obscure decodes, do not cause a problem.
t review
Change-Id: Ife9631c353ca5b8160019eb26d0fe781a5c2179f
This commit is contained in:
Jarrod Johnson 2017-02-26 13:25:38 -05:00
parent 42b6807840
commit d77d0a1904

View File

@ -229,12 +229,12 @@ class FRU(object):
if lang in (0, 25):
try:
retinfo = retinfo.decode('iso-8859-1')
except UnicodeDecodeError:
except (UnicodeError, LookupError):
pass
else:
try:
retinfo = retinfo.decode('utf-16le')
except UnicodeDecodeError:
except (UnicodeDecodeError, LookupError):
pass
# Some things lie about being text. Do the best we can by
# removing trailing spaces and nulls like makes sense for text