0

Path = location of batch file.(c:....\a.bat)

And a.bat contain following data: START C:\Python27\python.exe "C:.....\test.py"

I have the following code:

      my_process = subprocess.call(os.path.abspath(path), shell=True)

      text_file = open("output.txt",r)  # output.txt is batch file output

I expect the code should wait for batch file execution & output of batch file should generate output.txt. And later text_file = open("output.txt",r) should execute.

But code doesn't wait for batch file execution & sooner generate error that output.txt is not found.

1
  • 1
    START /WAIT maybe? Commented Jan 27, 2019 at 10:05

1 Answer 1

1

Thanks @MarkSetchell, it works with

START /WAIT

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.