Call .encode('utf-8') after splitting string as f.write() is expecting
an encoded string to write properly.
Issue: RELENG-1515
Change-Id: I88f70af17222fc7931a07e78eba23d9cc60eb9e7
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
resp = requests.get('{}/consoleText'.format(_format_url(build_url)))
with open('console.log', 'w+') as f:
- f.write(resp.text.split(MAGIC_STRING)[0])
+ f.write(str(resp.text.split(MAGIC_STRING)[0].encode('utf-8')))
resp = requests.get('{}/timestamps?time=HH:mm:ss&appendLog'.format(_format_url(build_url)))
with open('console-timestamp.log', 'w+') as f:
- f.write(resp.text.split(MAGIC_STRING)[0])
+ f.write(str(resp.text.split(MAGIC_STRING)[0].encode('utf-8')))
_compress_text(work_dir)