From 166df605dc9864eb163007300db7a611feb309d6 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 2 Dec 2016 20:20:41 -0500 Subject: fix decoding of utf-8 chars in yaml test Python 3 would fail to load yaml from doc/examples/cloud-config-apt.txt when the LANG (specifically LC_CTYPE) was 'C'. The changes here do 2 things: a.) remove the non-ascii characters from the yaml file. b.) fix the validate-yaml.py program to decode using utf-8 specifically rather than using the inherited settings. This fixes it now for ascii and in the future also should non-ascii slip in. --- tools/validate-yaml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/validate-yaml.py b/tools/validate-yaml.py index ed9037d9..2f28d230 100755 --- a/tools/validate-yaml.py +++ b/tools/validate-yaml.py @@ -12,8 +12,8 @@ if __name__ == "__main__": for fn in sys.argv[1:]: sys.stdout.write("%s" % (fn)) try: - fh = open(fn, 'r') - yaml.safe_load(fh.read()) + fh = open(fn, 'rb') + yaml.safe_load(fh.read().decode('utf-8')) fh.close() sys.stdout.write(" - ok\n") except Exception as e: -- cgit v1.2.3