Merge pull request #58 from hazanjon/tools_windows_fix

tilda_tools - Fix "'charmap' codec can't decode byte 0x9d" on windows for validate, sync, run
sammachin-gprs
Marek Ventur 2018-09-01 18:45:43 +01:00 committed by GitHub
commit 2cd2ca468f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 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,7 @@ def add_metadata(path, resources):
if file:
try:
with open(os.path.join(path, file), "r") as stream:
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 +197,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))