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

Package seems to be broken #90

Closed to7m closed 3 years ago

to7m commented 3 years ago

OS: Arch Linux Python version: 3.9.1

For some reason, the package seems to have broken on my end. I tried uninstalling, deleting, and reinstalling, but this had no effect.

The code

from inotify.adapters import Inotify
Inotify()

now exits with this:

Traceback (most recent call last):
  File "/tmp/atom_script_tempfiles/d02b5a90-9177-11eb-8afb-63dac8fbe55c", line 3, in <module>
    Inotify()
  File "/home/to7m/.local/lib/python3.9/site-packages/inotify/adapters.py", line 57, in __init__
    self.__inotify_fd = inotify.calls.inotify_init()
  File "/home/to7m/.local/lib/python3.9/site-packages/inotify/calls.py", line 34, in _check_nonnegative
    raise InotifyError("Call failed (should not be -1): (%d)" % 
inotify.calls.InotifyError: Call failed (should not be -1): (-1) ERRNO=(0)
Exception ignored in: <function Inotify.__del__ at 0x7fc9ac5f0160>
Traceback (most recent call last):
  File "/home/to7m/.local/lib/python3.9/site-packages/inotify/adapters.py", line 79, in __del__
    os.close(self.__inotify_fd)
AttributeError: 'Inotify' object has no attribute '_Inotify__inotify_fd'

Before this started happening, I found that Inotify(block_duration_s=-1).add_watch("/folder_that_does_not_exist") would give the same inotify.calls.InotifyError: Call failed (should not be -1) error instead of an error explicitly saying the folder doesn't exist, but now I can't reproduce this.

to7m commented 3 years ago

Sorry, I restarted the computer and the problem stopped.

bitmodeler commented 2 weeks ago

Restarting fixed it for me too!

I am using the version installed by "apt install python3-inotify" (so as not to "break" system packages...)

[I am guessing that maybe the activation of a kernel module could save one the trouble of a reboot?]