silently fails if path is file
avelican opened this issue · comments
Having written my code in a rush, I set the path to be a file rather than a directory.
The code runs without warnings or errors, but fails to report modifications to the file.
It seems watchdog supports only monitoring directories, not individual files.
I suggest watchdog should either:
A) support events on a single file (perhaps this can be done simply by monitoring its directory and ignoring changes on everything that isn't that file)
This solution seems more ergonomic from user POV.
Alternatively,
B) If given path is file, throw an exception and say it must be a directory
(Please forgive me if I've overlooked something, I haven't had time to take a proper look at how watchdog works yet.)
What OS?
I see this behavior on Windows 11 as well.
Could you post your code to reproduce the silent fail?
I tried to reproduce specifying file rather than a directory and then changing it. Watchdog once printed Deleted directory:
and my path to file. Not sure if it's a correct behavior but at least it doesn't fail. When I changed the file observed nothing happened.