Skip to content

Commit 4735128

Browse files
committed
Use io module to write utf-8 to files
1 parent 5430706 commit 4735128

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/mbed-greentea/mbed_greentea/mbed_greentea_cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import random
2424
import optparse
2525
import imp
26+
import io
2627
from time import time
2728
try:
2829
from Queue import Queue
@@ -980,7 +981,7 @@ def dump_report_to_text_file(filename, content):
980981
@return True if write was successful, else return False
981982
"""
982983
try:
983-
with open(filename, 'w') as f:
984+
with io.open(filename, encoding="utf-8", errors="backslashreplace", mode="w") as f:
984985
f.write(content)
985986
except IOError as e:
986987
gt_logger.gt_log_err("can't export to '%s', reason:"% filename)

0 commit comments

Comments
 (0)