I’m running a subprocess in full trace mode and displaying it using logger.info()
> std = subprocess.run(subprocess_cmd, shell=True,> universal_newlines=True, stdout=subprocess.PIPE,> stderr=subprocess.PIPE)> > all_stdout = all_stdout + std.stdout +‘\n’ all_stderr = all_stderr +> std.stderr +‘\n’> > logger.info(‘\nstdout:\n’+ all_stdout +‘\nstderr:\n’+ all_stderr)
But I’m getting the below error when the subprocess is getting printed.
UnicodeDecodeError: ‘utf-8’ codec can’t decide byte 0x90 in position 4024984:invalid start byte
I have tried giving universal_lines as False but it throws TypeError: must be str, not bytes.
I have also tried this -std = subprocess.run(subprocess_cmd, shell=True, stdout=subprocess.PIPE,
> stderr=subprocess.PIPE, env=environ, encoding=‘utf-8’)
This gives me same UnicodeDecodeError.