This question is the same as python subprocess.Popen - write to stderr. But there is no correct answers.
I know this is correct.
import sys
sys.stderr.write('abcd')
Here is the code of subprocess(named input). And I want the child process (input) to print the string written by parent process.
int main(int argc, char* argv[], char* envp[]){
char buf[5];
read(2, buf, 4);
buf[4]=0;
printf("%s\n", buf);
}
I want to write to a Python subprocess' stderr. However, this is not correct. (Maybe you can correct this or just introduce me another way.)
from subprocess import *
p = Popen(['./input'],stderr=PIPE)
p.stderr.write('abcd')
I got error like this.
IOError: File not open for writing
Thanks for your help.