dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
242 stars 73 forks source link

Add watch directly on pathlib instances #70

Open BVollmerhaus opened 5 years ago

BVollmerhaus commented 5 years ago

The add_watch function only supports strings when supplying the path to watch. Thus, if one uses Python 3.4's pathlib module for paths, it has to be converted to a string first when adding a watch:

path = pathlib.Path('a/path')
i = inotify.adapters.Inotify()
i.add_watch(str(path))

While minor, it could be useful to allow passing pathlib instances directly:

path = pathlib.Path('a/path')
i = inotify.adapters.Inotify()
i.add_watch(path)