2025년 9월 1일 월요일

subprocess.Popen

 Suppose 

(1) current foldder = '/a/' 

(2) exe file 'run.exe' and '_.input' files are located at folder ='/a/b/' 

(3) necessary input file absolute path is "/a/b/c/xxx.dat"


* To run the code using Popen, from (1) 

 p= Popen("./run.exe < _.input ", shell=True, cwd = 'b/') ; p.communicate() 

where '_.input' have relative path './c/xxx.dat' 

In other words, relative path ( ".","..") are interpreted from "cwd" path . 


*

p = Popen("../pikoe1 < 12Cp2pTDXinv.cnt",shell=True,cwd ="pikoe1/sample4/" ); p.communicate()

댓글 없음:

댓글 쓰기