[elbe-devel] [PATCH] fix use of encode instead of decode
bage at linutronix.de
bage at linutronix.de
Wed Jan 15 18:16:02 CET 2020
From: Bastian Germann <bage at linutronix.de>
91b938d2491 ("Python3: use encode instead of unicode() function") change the
Python 2 only unicode() call 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 | 2 +-
elbepack/licencexml.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 231471777..021fd71fa 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -157,7 +157,7 @@ class ElbeFilesystem(Filesystem):
lic_text = lic_text.encode(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