paul-nameless / pyfswatch

Python binding to libfswatch
MIT License
10 stars 9 forks source link

flags arg is invalid #6

Open stamhankar999 opened 3 years ago

stamhankar999 commented 3 years ago

While experimenting with Monitor today, I could capture fs events as per the example, but I could not determine the actual event-type that had occurred for the file in question (e.g. created, updated, etc.). I think flags is supposed to be an array of fsw_event_flag's, and flags_num is supposed to be the size of that array. However, flags (at the Python level) is an int, so I can't traverse the array. I think it's the memory address that has the array. based on this. Maybe that should be a ctypes.POINTER(ctypes.c_int).

Also, while I'm on the subject: what's the purpose of the event_num arg to the callback? If it's "number of events", that doesn't make sense for the monitor callback, which (from what I can tell) is called with one event. The lower-level callback takes two args (events, event_num), and there it does make sense.

Thanks.

Ansud commented 2 years ago

Check my PR to this repo https://github.com/paul-nameless/pyfswatch/pull/7