python subprocess call failing while same command line call works fine -
i trying replace command line call python script using subprocess:
path_to_executable = r'c:\uk\app\debug\lll.exe' x = subprocess.call([path_to_executable, args])
args
string looks this:
-unemp base -rate base -scen_name base -print_progress 0 -rate_date 1 -hpa base -dealpath c:\data\ -nthread 4 -deallist c:\config\all.txt -outdir c:\outdir\base
the call working when run command line, failing same arguments in subprocess following error:
fileioexception(unable open directory c:/.../hist.csv)
(the csv file present - it's file, not directory.)
my questions: 1. how it work through command line not subprocess? 2. why might trying open csv file directory, when it's not doing same thing on command line?
maybe subprocess not able locate file/directory..are sure file present , path file not contain special character (e.g. ~/) ?
otherwise try using argument shell=true
from subprocess doc:
subprocess.call(args, *, stdin=none, stdout=none, stderr=none, shell=false)
Comments
Post a Comment