On Oct 17, 12:43 pm, "kilnhead" <[EMAIL PROTECTED]> wrote: > I am opening a file using os.start('myfile.pdf') from python. How can I > know when the user has closed the file so I can delete it? Thanks.
I assume you mean os.startfile. There is no way to do this directly. os.startfile simply hands off the call to the OS and doesn't provide anything to track anything after that. Since you won't know what program handled the file association, you couldn't watch for an instance of that to start up and detect when it exits. Even if you could, it wouldn't be reliable as in the case of PDF's and Adobe Acrobat Reader, the user could close the document, but not the application, so your script would never delete the file in question. If anyone can think of a way to do this, it would be interesting to see how it's done. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list