I need to call an executable program with Python, let's say:
C:\Program Files\ANSYS Inc\v140\ansys\bin\winx64\ANSYS140.exe
I would need to have a txt file ( afshin.txt
) run with this executable application and then get the output file which is a txt file as well. In MATLAB for example it would be:
dos '"C:\Program Files\Ansys Inc\v121\ANSYS\bin\intel\ansys121.exe" -p AA_T_A -b -i afshin.txt -o file01.out'
mod_1 = load('output_res.txt');
Would you help me to do it in Python?
Have a look at envoy , a sane wrapper around subprocess:
import envoy
r = envoy.run("C:\Program Files\Ansys Inc\v121\ANSYS\bin\intel\ansys121.exe -p AA_T_A -b -i afshin.txt -o file01.out")
mod_1 = open("output_res.txt").read()
print mod_1
I have been use the following lines.
import os;
os.system("\"C:\\Apl\\ANSYS Inc\\v130\\ansys\\bin\\winx64\\ansys130.exe\" -b -j jobname -i InputFile.inp -o jobname.out");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.