[elbe-devel] [PATCH v2] fix use of encode instead of decode
bage at linutronix.de
bage at linutronix.de
Wed Jan 15 21:27:18 CET 2020
From: Bastian Germann <bage at linutronix.de>
91b938d2491 ("Python3: use encode instead of unicode() function") changed the
Python 2 only unicode() calls to encode() calls. However, decode is the right
function to be used here because a u"" string is expected as a result.
Signed-off-by: Bastian Germann <bage at linutronix.de>
---
elbepack/efilesystem.py | 4 ++--
elbepack/licencexml.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 231471777..83551f2f1 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -154,10 +154,10 @@ class ElbeFilesystem(Filesystem):
lic_text = "Error while processing license file %s: '%s'" % (
copyright_file, e.strerror)
- lic_text = lic_text.encode(encoding='utf-8', errors='replace')
+ lic_text = lic_text.decode(encoding='utf-8', errors='replace')
if f is not None:
- f.write(pkg.encode(encoding='utf-8', errors='replace'))
+ f.write(pkg.decode(encoding='utf-8', errors='replace'))
f.write(u":\n======================================"
"==========================================")
f.write(u"\n")
diff --git a/elbepack/licencexml.py b/elbepack/licencexml.py
index 09ab3cff7..ac84b330c 100644
--- a/elbepack/licencexml.py
+++ b/elbepack/licencexml.py
@@ -60,7 +60,7 @@ class copyright_xml (object):
txtnode = xmlpkg.append('text')
txtnode.et.text = copyright_text
- bytesio = io.StringIO(txtnode.et.text.encode(encoding='utf-8', errors='replace'))
+ bytesio = io.StringIO(txtnode.et.text.decode(encoding='utf-8', errors='replace'))
try:
c = Copyright(bytesio)
files = []
--
2.20.1
More information about the elbe-devel
mailing list