I have this code:
def method_a(self):
command_line = 'somtoolbox GrowingSOM ' + som_prop_path
subprocess.Popen(shlex.split(command_line))
......
def method_b(self): .....
....
and, as you can see, method_a has a subprocess that calls the somtoolbox program. But this program has a long stdout, and I want to hide it. I tried:
subprocess.Popen(shlex.split(command_line), stdout=subprocess.PIPE)
But it returned this sentence:
cat: record error: Broked Pipe
(This is a translation of the Portuguese sentence: "cat: erro de gravação: Pipe quebrado") (I'm from Brazil)
In addition, I have other methods (e.g. method_b) that are called after the method_a method, and tis methods are executed before the subprocess completes the process.
How can I hide stdout at all (and don't want it anywhere) and make other code wait for the subprocess to complete?
Obs: somtoolbox is a java program that provides long output to the terminal. I tried:
outputTuple = subprocess.Popen(shlex.split(command_line), stdout = subprocess.PIPE).communicate()
but continuous output to shell. Help!