How to use htmltestrunner.py to report importerror: no module named ‘stringio’ in python3
1. The reason is that the official website is written in python2 syntax, and the official manually changes the official website’s htmltestrunner.py to python3 syntax:
2. Modification summary:
Line 94, change import stringio to import io
Line 539, change self. Outputbuffer = stringio. Stringio() to self. Outputbuffer = io. Stringio ()
On line 642, change if not rmap. Has_ Key (CLS): modify to if not CLS in rmap:
In line 766, change uo = O. code (‘latin-1 ‘) to uo = E
In line 772 (775 if not found), change UE = E. decode (‘latin-1 ‘) to UE = E
On line 631, print & gt> Sys. Stderr, ‘\ ntime elapsed% s’% (self. StopTime self. Starttime) is modified to print (sys. Stderr,’ \ ntime elapsed% s’% (self. StopTime self. Starttime))
Typeerror: write() argument must be STR, not bytes+
There is a problem with the file opening method. If you change the previous opening statement to binary mode, there is no problem
fo = open("temp.txt", "wb+") #Change 'w' to 'wb+'