linux os.rename() not an actual rename?

Jason H jhihn at gmx.com
Mon Jul 20 20:02:51 CEST 2015


I have a server process that looks (watches via inotify)  for files to be moved (renamed) into a particular directory from elsewhere on the same filesystem. We do this because it is an atomic operation, and our server process can see the modify events of the file being written before it is closed. The rename functions as a 'completed' event.  We have a python script that attempts to perform this behavior - to os.rename() a file into the watched directory after it is done being written. However unlike other tools, we don't see a proper 'rename' event. Instead we just see a 'changed' event. I've changed the implementation of the script to os.system('mv ...') and we get the expected 'rename' event. 

Is this known issue? Should I be seeing a proper rename event? The only mention in the docs about the rename behavior is that it is atomic, as required by POSIX. 


More information about the Python-list mailing list