views:

39

answers:

2

I have a python script that ends with running a program (iexpress.exe) in a dos prompt.
The program that runs in dos prompt, uses a dir called workdir. After the program has finished in the dos prompt I would like python to delete the dir. I have just made a simple solution of putting a delay of 30sec:

time.sleep(30)
removeall(workdir)
os.rmdir(workdir)

But how should I do it, if python should delete the dir right after the process has finished?

A: 

Make the python program call the exe and not fall off the end

ie call the exe using subprocess.Popen

The when the exe finishes you are still in python

Mark
A: 

Thanks. It works fine