[ovs-dev] [PATCH v2] bugtool: Fix for Python3

William Tu u9012063 at gmail.com
Thu Mar 19 19:20:19 UTC 2020

On Thu, Mar 19, 2020 at 12:05 PM Timothy Redaelli <tredaelli at redhat.com> wrote:
> Currently ovs-bugtool tool doesn't start on Python 3.
> This commit fixes ovs-bugtool to make it works on Python 3.
> Replaced StringIO.StringIO with io.BytesIO since the script is
> processing binary data.
> Reported-at: https://bugzilla.redhat.com/1809241
> Reported-by: Flavio Leitner <fbl at sysclose.org>
> Signed-off-by: Timothy Redaelli <tredaelli at redhat.com>
> ---
> Changes since v1:
>   * Converted StringIO to BytesIO
>   * Fix some other string/bytes conversion
> ---

Thanks for sending out v2. Hit an error below:
~/ovs# python3
Python 3.5.2 (default, Oct  8 2019, 13:06:37)

~/ovs# ./utilities/bugtool/ovs-bugtool -y -s --output=tar.gz
Traceback (most recent call last):
  File "./utilities/bugtool/ovs-bugtool", line 1405, in <module>
  File "./utilities/bugtool/ovs-bugtool", line 717, in main
  File "./utilities/bugtool/ovs-bugtool", line 388, in collect_data
    v['output'] = BytesIOmtime(s)
  File "./utilities/bugtool/ovs-bugtool", line 1395, in __init__
    BytesIO.__init__(self, buf)
TypeError: a bytes-like object is required, not 'str'

I think sometimes 's' is bytes type, sometimes 's' is a str type...

More information about the dev mailing list