I have a piece of code as below:
test_process = subprocess.Popen(['python', self.bin_dir + '/' + self.bin_name] + arg_list,
cwd=os.path.normpath(cwd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
o = test_process.communicate()[0]
o = (o or b'')
sys.stdout.write(o.decode("utf-8"))
On windows8 machine when I run this piece of code with python3, it gives such error:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 898229: invalid start byte
This code works on Linux environment, I tried adding encoding='utf8'
to the Popen call but that won't solve the issue, current thought is that Windows does not use utf-8 as Popen stdout, however not have an idea to fix this issue, any idea?