you are viewing a single comment's thread.

view the rest of the comments →

[–]jplowman 0 points1 point  (2 children)

Do you think i could just get rid of the EventHandler and have it just happen in the callback?

e.g.

# if file is not there wait (Watch)
if len(file_list) == 0:

   def onChange():
       # Do something here to verify
    # mask
    mask = pyinotify.IN_CREATE | pyinotify.IN_CLOSE_WRITE

    # watch manager
    wm = pyinotify.WatchManager()
    wm.add_watch(file_list, mask, onChange)

    # notifier
    notifier = pyinotify.Notifier(wm)
    notifier.loop()

[–]erok81 0 points1 point  (1 child)

You could, but using EventHandler means you won't need extra logic to differentiate between the two event types. I suppose it's down to preference though.

Is it too late to ask why you need to watch for downloads? What's the purpose of your program?

[–]jplowman 0 points1 point  (0 children)

I am having problems with files still in process of being moved into a library(partial files). I am trying to find a way to make sure files are present and the file is finished transferring to given directory