From 11559534622d75d7630fc19709c8a5cc7a8a5b95 Mon Sep 17 00:00:00 2001 From: Jon Hazan Date: Sat, 1 Sep 2018 18:19:14 +0100 Subject: [PATCH 1/2] Fix charmap error when using tilda_tools on windows --- .development/pyboard_util.py | 2 +- .development/resources.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.development/pyboard_util.py b/.development/pyboard_util.py index db1ef2d..6bfa30a 100644 --- a/.development/pyboard_util.py +++ b/.development/pyboard_util.py @@ -81,7 +81,7 @@ def find_tty(): def check_run(paths): for filename in paths: - with open(filename, 'r') as f: + with open(filename, 'r', encoding='utf8') as f: pyfile = f.read() compile(pyfile + '\n', filename, 'exec') diff --git a/.development/resources.py b/.development/resources.py index cae7da0..9d13672 100644 --- a/.development/resources.py +++ b/.development/resources.py @@ -141,7 +141,8 @@ def add_metadata(path, resources): if file: try: - with open(os.path.join(path, file), "r") as stream: + print(os.path.join(path, file)) + with open(os.path.join(path, file), "r", encoding='utf8') as stream: resource.update(_normalize_metadata(read_metadata(stream))) except ParseException as e: resource.setdefault("errors", []).append(file + ": " + str(e)) @@ -197,7 +198,7 @@ def _validate_resource(path, resource): if file.endswith(".py"): try: filename = os.path.join(path, file) - with open(filename, 'r') as s: + with open(filename, 'r', encoding='utf8') as s: compile(s.read() + '\n', filename, 'exec') except Exception as e: resource.setdefault("errors", []).append(str(e)) From f3e3c98211e0788271b9fd4942065e65bf9b0ead Mon Sep 17 00:00:00 2001 From: Jon Hazan Date: Sat, 1 Sep 2018 18:25:04 +0100 Subject: [PATCH 2/2] Fix charmap error when using tilda_tools on windows --- .development/resources.py | 1 - 1 file changed, 1 deletion(-) diff --git a/.development/resources.py b/.development/resources.py index 9d13672..2f72c56 100644 --- a/.development/resources.py +++ b/.development/resources.py @@ -141,7 +141,6 @@ def add_metadata(path, resources): if file: try: - print(os.path.join(path, file)) with open(os.path.join(path, file), "r", encoding='utf8') as stream: resource.update(_normalize_metadata(read_metadata(stream))) except ParseException as e: