Python написать подпроцесс stdout stderr для файла
with open("stdout.txt","wb") as out, open("stderr.txt","wb") as err:
subprocess.Popen("ls",stdout=out,stderr=err)
Outrageous Octopus