python - How to get the stdout and stderr for subprocess.call? -
i'm using subprocess.call
, , need output stdout , stderr. how can this?
notice check_output():
note not use stdout=pipe or stderr=pipe function. pipes not being read in current process, child process may block if generates enough output pipe fill os pipe buffer.
my call might produce lot of output, safe way output?
something work:
f = file('output.txt','w') g = file('err.txt','w') p = subprocess.popen(cmd, shell=true, stdout=f, stderr=g) f.close() g.close()
Comments
Post a Comment