Python.Popen subprocess - adding GCC flags results in "no input files" error
I am creating a Python script to automate my build process that calls GCC using a subprocess. Popen. My initial attempt works fine.
>>> import subprocess
>>> p = Popen(['gcc', 'hello.c'], stdout=subprocess.PIPE, stderr=stderr=subprocess.STDOUT)
>>> p.wait()
0
>>> p.communicate()
('', None)
However, as soon as I pass the additional options to GCC, I get a "no input files" error as shown below:
>>> import subprocess
>>> p = Popen(['gcc', '-o hello hello.c'], stdout=subprocess.PIPE, stderr=stderr=subprocess.STDOUT)
>>> p.wait()
1
>>> p.communicate()
('gcc: no input files\r\n', None)
Any ideas that might be causing this problem?
+2
stackoverflow
source
to share