How can I check when a file window is closed? I tried this:
import time
import os
path = input()
os.startfile(request)
try:
file_path = open(path, 'rb')
except Exception:
done = True
while done:
if file_path.closed:
done = False
time.sleep(SLEEP_TIME)
So the file starts before I start checking if the file is closed. Then, I open the file again, and because its open already, an exception should pop up, where I'm looping until the file is closed. I don't know whether the indication I made is right or not.
Please help!!! I'm desperate!!!