I am trying to read data from a set of print statements in a C ++ program that runs using a subprocess.
C ++ Code:
printf "height= %.15f \\ntilt = %.15f \(%.15f\)\\ncen_volume= %.15f\\nr_volume= %.15f\\n", height, abs(sin(tilt*pi/180)*ring_OR), abs(tilt), c_vol, r_vol; e;
Python Code:
run = subprocess.call('Name', stdout = subprocess.PIPE, env={'LANG':'C++'})
data, error = run.communicate()
However, instead of getting the data, all I get is a single int, exit code, or 0, or an error code. Of course, python then tells me: "AttributeError: the int object does not have the communicate attribute.
How can I get data (printf)?
source
share