0

Using python 2.7 on windows 7 64 bit machine. How to get a file close event:

  1. when file is opened in a new process of file opener (like notepad, wordpad which opens file everytime in new process of wordpad)
  2. when file is opened in a tab of file opener (like notepad++, which opens all files in new tab but there exist only a single process of notepad++ running)

So, how to get file close event in above cases? Is it possible to achieve above cases through a common code? I am dealing with different file types.

It can also be solved by this scheme, when a file opens, a certain process handles it. And when it closes, all processes which controls it are also lost. So, we can know whether a file is closed or not.

I posted this in this q&a, and tried with watchdog, pywatch and Watcher but not able to get file close event

3
  • So you don't mean catching as in exceptions, but rather detecting a file system event?
    – 2rs2ts
    Commented Mar 18, 2014 at 13:12
  • 2
    This question contains some more discussion on this stackoverflow.com/questions/11114492/…
    – ebarr
    Commented Mar 18, 2014 at 13:31
  • @2rs2ts file system event is just a way to achieve file close event. I want basically file close event
    – imp
    Commented Mar 18, 2014 at 14:24

0