Hello Python community,
Recently I encountered this python error when try to run some tests on Ubuntu and Windows Python 3.10.4 using pytest module:
Traceback (most recent call last): E File "/usr/lib/python3.10/io.py", line 54, in <module> E ImportError: cannot import name 'text_encoding' from 'io' (unknown location)
Tried to search on internet but the only related “solution” is to reinstall python, I tried but did not work. Hope someone can help, thank you!
The Windows full error is here.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ result = <ExecutionResult object at 0x000001EAAAC> check_error_string = True @staticmethod def RaiseIfError(result, check_error_string=True): """Raise an Execution error if the result of the process indicates failure. Args: result: ExecutionResult, The result of the process. check_error_string: bool, True to raise if 'ERROR' is found in stdout or stderr. False to raise on non-zero exit code only. Raises: ExecutionError: If failure was detected for the process. """ fail = result.return_code != 0 if check_error_string: fail |= result.stdout is not None and 'ERROR' in result.stdout fail |= result.stderr is not None and 'ERROR' in result.stderr if fail: > raise ExecutionError(result) E ExecutionError: Command failed: E Command: E cmd /c some command E Exit Code: E 1 E E Stderr: E Fatal Python error: init_sys_streams: can't initialize sys standard streams E Python runtime state: core initialized E Traceback (most recent call last): E File "C:\Program Files\Python310\lib\io.py", line 54, in <module> E ImportError: cannot import name 'text_encoding' from 'io' (unknown location) lib\tests\lib\exec_utils.py:154: ExecutionError