Fix typo with UnicodeEncodeError // Issue #2796

This commit is contained in:
Ivan Kravets
2019-10-17 19:28:57 +03:00
parent 6218b773fd
commit 5cfa2b7fdd

View File

@ -62,7 +62,7 @@ def write_file_contents(path, contents):
try: try:
with open(path, "w") as fp: with open(path, "w") as fp:
return fp.write(contents) return fp.write(contents)
except UnicodeDecodeError: except UnicodeEncodeError:
with io.open(path, "w", encoding="latin-1") as fp: with io.open(path, "w", encoding="latin-1") as fp:
return fp.write(contents) return fp.write(contents)