2

Unfortunately my implementation is far too complex for me copy paste here (700+ lines), so I will explain as best as I can. I am using pyinotify to monitor a directory and check for, among other things, file creation. Every time a file is created, an IN_CREATE signal/flag is generated. I take this to mean that the file has been created. I then try to access the file's information via the following command

os.stat ( '/foo/bar.txt.swx' ).st_mode

but this generates the following error

OSError: [Errno 2] No such file or directory: '/foo/bar.txt.swx'

I believe one of three things is happening, can someone confirm which one:

  1. I made a stupid mistake such as immediately deleting the file in the python script
  2. inotify is non blocking, and the OS deleted the file before I could process the IN_CREATE signal (this happens a lot with complex saving methods such as vim's)
  3. IN_CREATE does not mean what I think it means (see below).

enter image description here

4

0 回答 0