Skip to content

Commit 2a420b1

Browse files
author
Marcelo Salazar
authored
Fix TypeError error on write()
Error: TypeError: write() argument 1 must be unicode, not str The fix ensures the write is in utf-8 encoding.
1 parent ab76a27 commit 2a420b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/mbed-greentea/mbed_greentea/mbed_greentea_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ def dump_report_to_text_file(filename, content):
984984
"""
985985
try:
986986
with io.open(filename, encoding="utf-8", errors="backslashreplace", mode="w") as f:
987-
f.write(content)
987+
f.write(content.decode('utf-8'))
988988
except IOError as e:
989989
gt_logger.gt_log_err("can't export to '%s', reason:"% filename)
990990
gt_logger.gt_log_err(str(e))

0 commit comments

Comments
 (0)