Fix `UnicodeEncodeError` on Windows Platforms

Prevents the following error from appearing when running training on Windows platforms:
```
UnicodeEncodeError: 'charmap' codec can't encode characters in position: character maps to <undefined>
```
This commit is contained in:
Guy Elsmore-Paddock 2021-03-20 15:59:44 -04:00 committed by Guy Elsmore-Paddock
parent 3947750dd9
commit 15459627cc
1 changed files with 1 additions and 1 deletions

View File

@ -69,7 +69,7 @@ def copy_model_files(c, config_file, out_path, new_fields):
else:
new_line = '"{}":{},\n'.format(key, json.dumps(value, ensure_ascii=False))
config_lines.insert(1, new_line)
config_out_file = open(copy_config_path, "w")
config_out_file = open(copy_config_path, "w", encoding="utf-8")
config_out_file.writelines(config_lines)
config_out_file.close()
# copy model stats file if available