Giter Site home page Giter Site logo

Comments (11)

bigdrum avatar bigdrum commented on August 16, 2024

+1 I have the same problems on my ubuntu laptop.

from watchdog.

senko avatar senko commented on August 16, 2024

The exception raised when the move is from outside the monitored directory to the monitored directory is because the inotify observer assumes there was a MOVE_FROM inotify event, and tries to get source path from it.

I've got a branch modifying the observer to use None sa the src_path in such cases, instead of raising an exception. I've issued a pull request for it: #49

The other issue, missing move events when files are moved OUTSIDE the monitored directories, is IMHO much harder to solve. The way the code works is by first caching the MOVE_FROM inotify event (as described above), and then acting when MOVE_TO inotify event occurs. Since the MOVE_TO event never occurs because the target directory is not monitored, the observer doesn't register that the move has happened.

from watchdog.

gorakhargosh avatar gorakhargosh commented on August 16, 2024

I've merged the pull request into HEAD.

Cheers!

from watchdog.

gorakhargosh avatar gorakhargosh commented on August 16, 2024

If the issue has been resolved for you, you may
close this issue. =)

from watchdog.

adam-p avatar adam-p commented on August 16, 2024

Have both sub-issues been fixed? Senko's comment made it sound as if moving files into a watched directory is fixed, but not moving files out of a watched directory. I'm interested in both cases...

Thanks for the great project, btw.

from watchdog.

senko avatar senko commented on August 16, 2024

I'm not sure that it CAN be fixed reliably. One hack would be to remember MOVE_FROM events, and for each check (after some delay) whether a corresponding MOVE_TO event happened. If not, it's an out move. But I don't especially like this solution, feels hackish (in a negative way) to me.

from watchdog.

matmas avatar matmas commented on August 16, 2024

So PollingObserver is better in this regard than InotifyObserver. Maybe it will be good to have some SimpleInotifyObserver, that would handle moves as create/delete combos. PollingObserver is good enough for me, so from watchdog.observers.polling import PollingObserver as Observer does the trick for now

from watchdog.

blaxter avatar blaxter commented on August 16, 2024

With this zentyal@9bd7030 you will have events when you move files or directories outside the watched path.

The problem is that for directories (with recursive=True) there should be 'n' events, one per file inside it, that's not possible (afaik) because we don't know the destiny. So in the end this is only a partial workaround, and your application code must know about this issue when using InotifyObserver.

from watchdog.

tamland avatar tamland commented on August 16, 2024

@blaxter that only works if the from/to pairs happens to be in the same buffer when read. Do a batch move inside a watched tree and it'll probably fire duplicate events.

from watchdog.

tamland avatar tamland commented on August 16, 2024

I've made an attempt at implementing the much talked about buffer approach. Basically all events are delayed and move from/to pairs matched during this delay. It's not pretty but appears to work ok. Current delay is set to 0.5 seconds (can be changed in inotify_buffered.py). Checkout branch delayed-inotify

from watchdog.

tamland avatar tamland commented on August 16, 2024

fixed

from watchdog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.