Fix charmap error when using tilda_tools on windows

sammachin-gprs
Jon Hazan 2018-09-01 18:19:14 +01:00
parent 15de09127c
commit 1155953462
2 changed files with 4 additions and 3 deletions

View File

@ -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')

View File

@ -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))