I have a program which I want to execute in for loops with changing input.
import subprocess
for num in range(StartingPoint, EndingPoint):
p = subprocess.Popen("C:\\Programming\\simple\\Simple_C\\bin\\Simple_C.exe",
shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
p.communicate(input='%d\n' % num)
output = p.communicate()[0]
print (output)
But I get this error:
TypeError: 'str' does not support the buffer interface
The program asks for a number and Python should give it "num", is there a better solution to this? I am using Python version 3.3.2.