[ovs-dev] [PATCH] ovs-bugtool: Fix for python3.

Ben Pfaff blp at ovn.org
Fri Feb 28 23:20:55 UTC 2020


On Tue, Feb 25, 2020 at 11:59:06AM -0800, William Tu wrote:
> Currently ovs-bugtool does not work due to Python2 deprecated.
> When moving to Python3, a couple of things are broken in ovs-bugtool,
> ex: import libraries issues such as StringIO and commands.
> Also there are some bytes to string convertion in this patch
> because in Python3,strings are now always Unicode and a new type 'bytes'
> is added for handling binary strings.
> 
> Signed-off-by: William Tu <u9012063 at gmail.com>

Some of these are a little puzzling.  I see a lot more use of list()
than I would have expected to be necessary.

For example, I don't know why this change is needed:
> -        for (k, v) in data.items():
> +        for (k, v) in list(data.items()):
>              cap = v['cap']
>              if 'cmd_args' in v:

and I think that this can be just "if 'output' not in v:"
> -                if 'output' not in v.keys():
> +                if 'output' not in list(v.keys()):
>                      v['output'] = StringIOmtime()
>                  if v['repeat_count'] > 0:
>                      if cap not in process_lists:

Thanks,

Ben.


More information about the dev mailing list