From 601fb2fcd00fbd199cbe4f1f146a2119bc6fc923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Wed, 2 May 2018 14:47:05 +0200 Subject: [PATCH] Python: make compatible with 3.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit subprocess.*(…, encoding='utf-8') → .decode('utf-8') --- generate_eh_elf.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/generate_eh_elf.py b/generate_eh_elf.py index d1e8f06..d314c87 100755 --- a/generate_eh_elf.py +++ b/generate_eh_elf.py @@ -29,8 +29,8 @@ def elf_so_deps(path): deps_list = [] try: - ldd_output = subprocess.check_output(['/usr/bin/ldd', path], - encoding='utf8') + ldd_output = subprocess.check_output(['/usr/bin/ldd', path]) \ + .decode('utf-8') ldd_re = re.compile(r'^.* => (.*) \(0x[0-9a-fA-F]*\)$') ldd_lines = ldd_output.strip().split('\n') @@ -55,9 +55,10 @@ def gen_dw_asm_c(obj_path, out_path): try: with open(out_path, 'w') as out_handle: + # TODO enhance error handling dw_asm_output = subprocess.check_output( - [DWARF_ASSEMBLY_BIN, obj_path], - encoding='utf8') # TODO enhance error handling + [DWARF_ASSEMBLY_BIN, obj_path]) \ + .decode('utf-8') out_handle.write(dw_asm_output) except subprocess.CalledProcessError as e: raise Exception(