Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] [PATCH 7/9] hash_utils: decode output of popen
Date: Wed, 28 Oct 2015 14:50:04
Message-Id: 20151028074911.0fe57236.dolsen@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH 7/9] hash_utils: decode output of popen by Mike Frysinger
1 On Mon, 12 Oct 2015 00:36:00 -0400
2 Mike Frysinger <vapier@g.o> wrote:
3
4 > In py3, the return of popen is binary data. We need
5 > to decode it to get a string we can work with.
6 > ---
7 > catalyst/hash_utils.py | 2 +-
8 > 1 file changed, 1 insertion(+), 1 deletion(-)
9 >
10 > diff --git a/catalyst/hash_utils.py b/catalyst/hash_utils.py
11 > index 1161da3..6e08967 100644
12 > --- a/catalyst/hash_utils.py
13 > +++ b/catalyst/hash_utils.py
14 > @@ -117,7 +117,7 @@ class HashMap(object):
15 > log.debug('args = %r', args)
16 > source = Popen(args, stdout=PIPE)
17 > output = source.communicate()
18 > - lines = output[0].split('\n')
19 > + lines = output[0].decode('ascii').split('\n')
20 > log.debug('output = %s', output)
21 > header = lines[0]
22 > h_f = lines[1].split()
23
24
25 looks good
26 --
27 Brian Dolbec <dolsen>