scripts: spdxcheck: resovle decode warning for python3
PATCH 1/1 scripts: spdxcheck: resovle decode warning for python3
From: shubhsherl <[email protected]>
Resolve a warning issue by spdxcheck in Python3
FAIL: 'str' object has no attribute 'decode'
Signed-off-by Shubham Singh <[email protected]>
--- scripts/spdxcheck.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/spdxcheck.py +2 -1
@@ -168,7 +168,8 @@ class id_parser(object): self.curline = 0 try: for line in fd: - line = line.decode(locale.getpreferredencoding(False), errors='ignore') + if type(line) != str: + line = line.decode(locale.getpreferredencoding(False), errors='ignore') self.curline += 1 if self.curline > maxlines: break
Signature · 1 line
2.18.0
Hi Shubham,
Quoted 16 lines · Shubham Singh
From: shubhsherl <[email protected]>
Resolve a warning issue by spdxcheck in Python3
FAIL: 'str' object has no attribute 'decode'Signed-off-by Shubham Singh <[email protected]>--- scripts/spdxcheck.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)scripts/spdxcheck.py +0
-0
scripts/spdxcheck.py class id_parser(object): · line 175
Quoted 9 lines
scripts/spdxcheck.py +2
-1@@ -168,7 +168,8 @@ class id_parser(object): self.curline = 0 try: for line in fd: - line = line.decode(locale.getpreferredencoding(False), errors='ignore') + if type(line) != str: + line = line.decode(locale.getpreferredencoding(False), errors='ignore') self.curline += 1 if self.curline > maxlines: break
This looks to be a fix for the same issue addressed by "[PATCH] scripts/spdxcheck.py: improve Python 3 compat"[0].
Can you reproduce the warning with that patch?