import inotify.adapters
def _main():
i = inotify.adapters.Inotify()
i.add_watch('/tmp')
with open('/tmp/test_file', 'w'):
pass
events = i.event_gen(yield_nones=False, timeout_s=1)
events = list(events)
print(events)
if __name__ == '__main__':
_main()
$ python file-watcher.py
Traceback (most recent call last):
File "file-watcher.py", line 1, in <module>
import inotify.adapters
File "/Users/sarit/.pyenv/versions/life/lib/python3.7/site-packages/inotify/adapters.py", line 11, in <module>
import inotify.calls
File "/Users/sarit/.pyenv/versions/life/lib/python3.7/site-packages/inotify/calls.py", line 39, in <module>
inotify_init = _LIB.inotify_init
File "/Users/sarit/.pyenv/versions/3.7.3/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
func = self.__getitem__(name)
File "/Users/sarit/.pyenv/versions/3.7.3/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x11816fe90, inotify_init): symbol not found
OSX: 1014.2 Python: 3.7.3 inotify==0.2.10
Any idea?