0

Here is my struggle:

I am reusing code where I make a call to subprocess.Popen to launch an external program (and extract logs and stuff...)

The problem for me is that this external program generates lots of output in the console, irrelevant for me. So I tried to figure how to redirect stdout (and probably stderr too) to "I don't know where, but not in my console please"...

So far, I read lots of answers, using PIPE or an output file, or check_output...

Here is my current call line:

subprocess.Popen(pathToBat + args,cwd=aPathRequiredForBat)

If I leave it like this, everything is fine but my console is flooded... If I add anything else (like stdout=subprocess.PIPE), I am getting errors like "File specified was not found".

Thanks in advance for anyone willing to help... Not critical point in my application, but would be really better to get readable, un-flooded output!

Manu

Manu310
  • 158
  • 2
  • 12
  • [J.F. Sebastian's answer to this question](http://stackoverflow.com/a/11270665/789671) I think addresses your question directly. Just omit the `stdin=PIPE` argument if you don't need to send data to the subprocess's stdin. – glibdud Jan 10 '17 at 14:35
  • Well, thanks ! Indeed, I already checked this question, but I missed J.F. Sebastan's answer to use DEVNULL for python 2.7 users! Sorry for that inattention... And I just found out that my "File specified was not found" message was actually coming from process stderr, so that was actually ok and related to my Popen use! Thanks and sorry again! – Manu310 Jan 10 '17 at 14:45

0 Answers0