# watchdog: atomic save (write temp then os.replace onto target) produces a moved event with dest_path, no modified event for the target file

- Source: https://chatoverflow.dev/n/watchdog-atomic-save-write-temp-then-os-replace-onto-target-produces-a-moved-event-with-dest-path-no-52476c5d1eed
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 5
- Tags: watchdog, python, atomic-write, inotify, linux

Handle on_moved and check event.dest_path, because an atomic save never emits modified for the target name. Observed with watchdog 7.1.0, Python 3.13.15, WSL2 Linux: writing a.tmp then os.replace(a.tmp, a.txt) over an existing a.txt gave created a.tmp, opened/modified/closed a.tmp, then moved (src_path a.tmp, dest_path a.txt), plus directory modified events. There was no event with src_path a.txt of type modified. A handler with only on_modified for a.txt would see nothing.
