httprunner 的报告提示 OSError: [WinError 6] 句柄无效。

执行命令后,查看报告提示 OSError: [WinError 6] 句柄无效。

hrun demo/testcases/createFolder_test.py  --html=demo/reports/report.ht
ml

环境:
httprunner版本:3.x
os: window10

错误日志

--- Logging error in Loguru Handler #0 ---
Record was: {'elapsed': datetime.timedelta(seconds=2, microseconds=797505), 'exception': None, 'extra': {}, 'file': (name='loader.py', path='c:\\users\\lnz\\pycharmprojects\\httprunner_study\\venv\\lib\\site-packages\\httprunner\\loader.py'), 'function': 'load_dot_env_file', 'level': (name='INFO', no=20, icon='ℹ️'), 'line': 127, 'message': 'Loading environment variables from C:\\Users\\lnz\\PycharmProjects\\httprunner_study\\demo\\.env', 'module': 'loader', 'name': 'httprunner.loader', 'process': (id=25780, name='MainProcess'), 'thread': (id=14432, name='MainThread'), 'time': datetime(2020, 7, 25, 17, 43, 27, 794163, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), '中国标准时间'))}
Traceback (most recent call last):
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\loguru\_handler.py", line 177, in emit
    self._sink.write(str_record)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\loguru\_simple_sinks.py", line 26, in write
    self._stream.write(message)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\colorama\ansitowin32.py", line 41, in write
    self.__convertor.write(text)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\colorama\ansitowin32.py", line 162, in write
    self.write_and_convert(text)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\colorama\ansitowin32.py", line 187, in write_and_convert
    self.write_plain_text(text, cursor, start)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\colorama\ansitowin32.py", line 196, in write_plain_text
    self.wrapped.flush()
OSError: [WinError 6] 句柄无效。
--- End of logging error ---
--- Logging error in Loguru Handler #0 ---
Record was: {'elapsed': datetime.timedelta(seconds=2, microseconds=800498), 'exception': None, 'extra': {}, 'file': (name='utils.py', path='c:\\users\\lnz\\pycharmprojects\\httprunner_study\\venv\\lib\\site-packages\\httprunner\\utils.py'), 'function': 'set_os_environ', 'level': (name='DEBUG', no=10, icon='🐞'), 'line': 33, 'message': 'Set OS environment variable: USERNAME', 'module': 'utils', 'name': 'httprunner.utils', 'process': (id=25780, name='MainProcess'), 'thread': (id=14432, name='MainThread'), 'time': datetime(2020, 7, 25, 17, 43, 27, 797156, tzinfo=datetime.timezone(datetime.timedelta(seconds=28800), '中国标准时间'))}
Traceback (most recent call last):
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\loguru\_handler.py", line 177, in emit
    self._sink.write(str_record)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\loguru\_simple_sinks.py", line 26, in write
    self._stream.write(message)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\colorama\ansitowin32.py", line 41, in write
    self.__convertor.write(text)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\colorama\ansitowin32.py", line 162, in write
    self.write_and_convert(text)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\colorama\ansitowin32.py", line 187, in write_and_convert
    self.write_plain_text(text, cursor, start)
  File "c:\users\lnz\pycharmprojects\httprunner_study\venv\lib\site-packages\colorama\ansitowin32.py", line 196, in write_plain_text
    self.wrapped.flush()
OSError: [WinError 6] 句柄无效。

报告截图:

html生成报告的文件不要加路径试一下,不知道为什么但是我不加路径是成功的,加了路径就会报错 可能是个BUG?

未加报告的路径,然后执行了命令:

hrun demo/testcases/createFolder_test.py  --html=report.html

结果:还是一样的错误