Hi all. 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 like you all see, method_a has a subprocess that is calling the somtoolbox program. But this program have 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)
Also, I have other methods (like method_b there), that are called after the method_a, and tis methods are running before the subprocess complete the process.
How I can hide the stdout at all (and don't want it anywhere), and make the other code wait for the subprocess to finish the execution ?
Obs: The somtoolbox is a java program, that gives the long output to the terminal. Tried:
outputTuple = subprocess.Popen(shlex.split(command_line), stdout = subprocess.PIPE).communicate()
but continuous returning output to the shell. Help!