I have run into a wall trying to use subprocess.run().
In windows, outside Visual Sudio, I open a command window and get:
c:\users>
Then I change directory
c:\users>cd c:\xfoil
Then I run the xfoil program
c:\xfoil\xfoil.exe < input_file.txt
xfoil runs and generates output text files.
I am trying to get this embedded in my code so I don't have to manually generate and import the xfoil input/output text files.
Here is an example of code I tried that didn't work.
import subprocess
xfoil_output = subprocess.run(r'c:\xfoil\xfoil.exe < input_file.txt')
It runs, but just runs forever, it doesn't give any errors, or create any output files. (Xfoil should generate those files in the xfoil directory, don't know or care what value the variable xfoil_output has). I have to stop debugging to end the program.
Found lots of examples here and elsewhere but can't make it work.
You should read the contents of the input file first, then should use subprocess.run() to execute XFOIL by providing the input content directly, like below: