From: Gurucharan Shetty Date: Fri, 20 Jun 2014 20:13:51 +0000 (-0700) Subject: test-ovsdb: Workaround unicode bug in Python 2.4.x. X-Git-Tag: v2.3~47 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=972e2d1de6e23197783fb70d043a84e615b21bd1 test-ovsdb: Workaround unicode bug in Python 2.4.x. Run the following command on Xenserver: PYTHONPATH=`pwd`/python/compat::`pwd`/python python ./tests/test-ovsdb.py \ parse-atoms '{"type": "string", "minLength": 2}' \ '[""]' '["a"]' '["ab"]' '["abc"]' '["\ud834\udd1e"]' And we get the following error: UnicodeEncodeError: 'ascii' codec can't encode character u'\U0001d11e' in position 23: ordinal not in range(128). It looks like we are hitting the following bug: http://bugs.python.org/issue2517 Signed-off-by: Gurucharan Shetty Acked-By: Ben Pfaff --- diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py index 392ed4b70..cec46bd63 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") def do_parse_data(type_string, *data_strings):