From c6d2400dccc2b5334bfab5f82f1a8bf1ab38f06c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 14 Feb 2020 10:04:53 -0800 Subject: revdep-rebuild: encode Popen args as utf-8 bytes (bug 709610) Prevent this Popen exception: UnicodeEncodeError: 'ascii' codec can't encode character '\xe8' in position 20: ordinal not in range(128) Bug: https://bugs.gentoo.org/709610#c0 Signed-off-by: Zac Medico --- pym/gentoolkit/revdep_rebuild/stuff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py b/pym/gentoolkit/revdep_rebuild/stuff.py index 3b0a980..002eb4b 100644 --- a/pym/gentoolkit/revdep_rebuild/stuff.py +++ b/pym/gentoolkit/revdep_rebuild/stuff.py @@ -19,6 +19,7 @@ def call_program(args): @param, args: arument list to pass to subprocess @return str ''' + args = [arg if isinstance(arg, bytes) else arg.encode('utf-8') for arg in args] subp = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = subp.communicate() stdout = stdout.decode('utf-8') -- cgit v1.2.3