[Spice-devel] [qxl 2/2] Xspice: Fix Python3 str() vs bytes() confusion

Pavel Grunt pgrunt at redhat.com
Thu Feb 9 18:58:59 UTC 2017


ack

On Wed, 2017-02-08 at 17:15 +0100, Christophe Fergeau wrote:
> With python3, without universal_newlines=True, Popen().stdout.read()
> will return a byte array, while find(str) expects to operate on a
> string.
> I've checked that this still works with python2 as well.
> ---
>  scripts/Xspice | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Xspice b/scripts/Xspice
> index 41fd80c..927dcb1 100755
> --- a/scripts/Xspice
> +++ b/scripts/Xspice
> @@ -135,7 +135,7 @@ def agents_new_enough(args):
>              return False
>  
>      for f in [args.vdagent_exec, args.vdagentd_exec]:
> -        if Popen(args=[f, '-h'], stdout=PIPE).stdout.read().find('-
> S') == -1:
> +        if Popen(args=[f, '-h'], stdout=PIPE,
> universal_newlines=True).stdout.read().find('-S') == -1:
>              return False
>      return True
>  


More information about the Spice-devel mailing list