[ovs-dev] [PATCH 2/2] test-ovsdb: Workaround unicode bug in Python 2.4.x.

Ben Pfaff blp at nicira.com
Tue Jun 24 16:13:14 UTC 2014


On Fri, Jun 20, 2014 at 12:22:15PM -0700, Gurucharan Shetty wrote:
> In addition to the above bug, I see some other wierdness while dealing with
> unicode on Xenserver and Python 2.4.3 . As an example, the following diff
> would work fine if python is run from command line but not from inside
> testsuite. When run from inside the testsuite we get the same unicode error.
> I am not sure why.

The testsuite sets LC_ALL=C and (from atlocal.in)
PYTHONIOENCODING=utf_8.  That might be the difference.

> diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
> index 392ed4b..cec46bd 100644
> --- a/tests/test-ovsdb.py
> +++ b/tests/test-ovsdb.py
> @@ -105,7 +105,7 @@ def do_parse_atoms(type_string, *atom_strings):
>              atom = data.Atom.from_json(base, atom_json)
>              print ovs.json.to_string(atom.to_json())
>          except error.Error, e:
> -            print unicode(e)
> +            print e.args[0].encode("utf8")

There's a lot of weirdness around python and encodings that varies from
version to version and from one Python configuration to the next.  Did
you try this on a non-XenServer system too, say Ubuntu?  Also you might
want to try on the Arch distro (I think that's Ethan uses) because I
seem to recall that it uses one of the oddball Python configurations
that has caused trouble in the past.

Thanks,

Ben.



More information about the dev mailing list