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+'
Similar Posts:
- Error reporting using Yum: Yum except keyboardinterrupt, e
- How to Solve Error: ‘_TestResult’ object has no attribute ‘outputBuffer’
- [Solved] Python Numpy Data load error: Unicode error: unpicking a python object failed: Unicode decodeerror
- [daily development record] pycurl Python 3 error (23),’failed writing body (0= 456)
- [design and development] Python learning notes – Super () argument 1 must be type, not classobj
- [Solved] Error: jedi-vim failed to initialize Python: jedi-vim requires Vim with support for Python 2 or 3
- [Solved] pytorchImportError: numpy.core.multiarray failed to import
- Python3.x Run Python2.x Codes syntax error: “Missing parentheses in call to ‘print’
- [Solved] tf.summary Error: tags and values not the same shape
- AttributeError: ‘_csv.reader’ object has no attribute ‘next’ [How to Solve]