Python version:Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Operating System:
Description
I use the HtmlTESTRunner, it reports the follow error.
Becouse of my testcase is output the conent like "[{'Text': 'æ\x96°å\x91\x98å·¥å\x85¥è\x81\x8c', ...}]"
so I modify the code of HTMLTESTRunner/result.py in 404, as "with open(path_file, 'w', encoding='utf-8') as report_file:", its running is ok!
Is this line code need to modify?
Traceback (most recent call last):
File "D:/autotest/testProject/testcase/suite/suite_test01.py", line 26, in
runner.run(suite)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\HtmlTestRunner\runner.py", line 112, in run
result.generate_reports(self)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\HtmlTestRunner\result.py", line 367, in generate_reports
self.generate_file(testRunner, report_name_body, html_file)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\HtmlTestRunner\result.py", line 404, in generate_file
report_file.write(report)
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 9767: illegal multibyte sequence
What I Did
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
Description
I use the HtmlTESTRunner, it reports the follow error. Becouse of my testcase is output the conent like "[{'Text': 'æ\x96°å\x91\x98å·¥å\x85¥è\x81\x8c', ...}]" so I modify the code of HTMLTESTRunner/result.py in 404, as "with open(path_file, 'w', encoding='utf-8') as report_file:", its running is ok! Is this line code need to modify? Traceback (most recent call last): File "D:/autotest/testProject/testcase/suite/suite_test01.py", line 26, in
runner.run(suite)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\HtmlTestRunner\runner.py", line 112, in run
result.generate_reports(self)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\HtmlTestRunner\result.py", line 367, in generate_reports
self.generate_file(testRunner, report_name_body, html_file)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\HtmlTestRunner\result.py", line 404, in generate_file
report_file.write(report)
UnicodeEncodeError: 'gbk' codec can't encode character '\xe6' in position 9767: illegal multibyte sequence
What I Did