Utility started from python code doesn't write in file -
i have 2 utilities written in c++, tcp/ip server , client have used years. server opens designated file , waits client connect. after connection has been established server starts send file's content. client receives , saves in file. now, want write python script start both application , wait them finish. after script other work. written windows. first script in python. , first problem can see both applications have started , connected each other. can see because 2 dos windows appears , show messages inform me connection. however, don't see file, has created client. wrong. code simple , follows.
import subprocess p = subprocess.popen('c:\myprojects\exes\feedsender_exe\feedsender.exe c:\myprojects\exes\feedsender_exe\feedsender.ini') print "start1" p1 = subprocess.popen('c:\myprojects\exes\feedreaderfileprocessor\feadreaderi41.exe c:\myprojects\exes\feedreaderfileprocessor\config.ini') print "start2" line in p.stdout.readlines(): print line, retval = p.wait() print "finish1" retval = p1.wait() print "finish2"
it set subprocess's current working directory.
p = subprocess.popen(r'c:\myprojects\exes\feedsender_exe\feedsender.exe c:\myprojects\exes\feedsender_exe\feedsender.ini', cwd=r'c:\myprojects\exes\feedsender_exe')
depending on how set programs, output file should show in c:\myprojects\exes\feedsender_exe
. can't programs, can't test this.
Comments
Post a Comment