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
245 stars 73 forks source link

Examples fail with errors #49

Closed mzpqnxow closed 6 years ago

mzpqnxow commented 6 years ago
(venv) user@host:~/venv$ cat test_inotify.py 
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
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()

(venv) user@host:~/prod-export/pybuild23$ ./test_inotify.py 
Traceback (most recent call last):
  File "./test_inotify.py", line 21, in <module>
    _main()
  File "./test_inotify.py", line 14, in _main
    events = i.event_gen(yield_nones=False, timeout_s=1)
TypeError: event_gen() got an unexpected keyword argument 'yield_nones'
(venv) user@host:~/venv$ 

Removing the yield_nones=False results in another error.

Is this expected? Just a matter of documentation being out of date? I can read the source but I think most users will want to have very basic examples in the README working.

If I look through the source and make a simple example I will PR it, unless I am (somehow) doing this wrong...

ajefferiss commented 6 years ago

I'm having the same issue, but have worked around it for the time being using the comments from https://github.com/dsoprea/PyInotify/issues/43. Once I had done that the examples worked as expected...

dsoprea commented 6 years ago

Could one of you put that into a PR?

On Thu, Apr 26, 2018, 05:39 Adam Jefferiss notifications@github.com wrote:

I having the same issue, but have managed to work around it for the time being using the comments from #43 https://github.com/dsoprea/PyInotify/issues/43

Once I had done that the examples worked as expected...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dsoprea/PyInotify/issues/49#issuecomment-384578271, or mute the thread https://github.com/notifications/unsubscribe-auth/AArragRVg998tKMXGr9aFuFQUUxD91H4ks5tsZXDgaJpZM4Tjid4 .

ajefferiss commented 6 years ago

Sorry, what do you want in a PR?

dsoprea commented 6 years ago

I hastily read the report and thought it was a problem with the example. I've done a 0.2.10 release. This should no longer be an issue. I've also dropped the 0.2.9 binary package since it'll likely do more harm than good.