Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Use python subprocess.call to run a .exe in another directory

$
0
0

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 subprocessxfoil_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.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>